               package com.buildings.activity;

import android.app.Dialog;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.text.TextUtils;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.Toast;

import androidx.annotation.Nullable;
import androidx.recyclerview.widget.DividerItemDecoration;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import com.buildings.R;
import com.buildings.activity.table.CraterActivity;
import com.buildings.activity.table.DrillHoleActivity;
import com.buildings.activity.table.FaultSvyPointActivity;
import com.buildings.activity.table.GeoGeomorphySvyPointActivity;
import com.buildings.activity.table.GeochemicalSvyLineActivity;
import com.buildings.activity.table.GeochemicalSvyPointActivity;
import com.buildings.activity.table.GeologicalSvyLineActivity;
import com.buildings.activity.table.GeologicalSvyPlanningLineActivity;
import com.buildings.activity.table.GeologicalSvyPlanningPtActivity;
import com.buildings.activity.table.GeologicalSvyPointActivity;
import com.buildings.activity.table.GeomorStationActivity;
import com.buildings.activity.table.GeomorphySvyLineActivity;
import com.buildings.activity.table.GeomorphySvyPointActivity;
import com.buildings.activity.table.GeomorphySvyReProfActivity;
import com.buildings.activity.table.GeomorphySvyRegionActivity;
import com.buildings.activity.table.GeomorphySvySamplePointActivity;
import com.buildings.activity.table.GeophySvyLineActivity;
import com.buildings.activity.table.GeophySvyPointActivity;
import com.buildings.activity.table.LavaActivity;
import com.buildings.activity.table.SamplePointActivity;
import com.buildings.activity.table.StratigraphySvyPointActivity;
import com.buildings.activity.table.TanCaodianActivity;
import com.buildings.activity.table.VolcanicSamplePointActivity;
import com.buildings.activity.table.VolcanicSvyPointActivity;
import com.buildings.adapter.LocalLineAdapter;
import com.buildings.api.Api;
import com.buildings.base.BaseActivity;
import com.buildings.base.BaseApplication;
import com.buildings.bean.CreaterDbEntity;
import com.buildings.bean.DrillHoleDbEntity;
import com.buildings.bean.FaultSvyPointDbEntity;
import com.buildings.bean.GeoGeomorphySvyPointDbEntity;
import com.buildings.bean.GeochemicalSvyLineDbEntity;
import com.buildings.bean.GeochemicalSvyPointDbEntity;
import com.buildings.bean.GeologicalSvyLineDbEntitiy;
import com.buildings.bean.GeologicalSvyPlanningLineDbEntity;
import com.buildings.bean.GeologicalSvyPlanningPtDbEntity;
import com.buildings.bean.GeologicalSvyPointDbEntity;
import com.buildings.bean.GeomorStationDbEntity;
import com.buildings.bean.GeomorphySvyLineDbEntity;
import com.buildings.bean.GeomorphySvyPointDbEntity;
import com.buildings.bean.GeomorphySvyReProfDbEntity;
import com.buildings.bean.GeomorphySvyRegionDbEntity;
import com.buildings.bean.GeomorphySvySamplePointDbEntity;
import com.buildings.bean.GeophySvyLineDbEntity;
import com.buildings.bean.GeophySvyPointDbEntity;
import com.buildings.bean.LavaDbEntity;
import com.buildings.bean.LocalBean;
import com.buildings.bean.LocationEntity;
import com.buildings.bean.LoginBean;
import com.buildings.bean.SamplePointDbEntity;
import com.buildings.bean.StratigraphySvyPointDbEntity;
import com.buildings.bean.TanCaodianDbEntity;
import com.buildings.bean.VolcanicSamplePointDbEntity;
import com.buildings.bean.VolcanicSvyPointDbEntity;
import com.buildings.event.AboutTaskEvent;
import com.buildings.event.MessageEvent;
import com.buildings.http.BaseCallBack;
import com.buildings.http.JsonBuilder;
import com.buildings.http.MyHttpClient;
import com.buildings.util.CustomToast;
import com.buildings.util.DialogUtils;
import com.buildings.util.FileUtil;
import com.buildings.util.SPUtil;
import com.buildings.view.AboutTaskFragmentDialog;
import com.buildings.view.OutLineAboutTaskFragmentDialog;
import com.buildings.view.SelectTypeFragmentDialog;
import com.google.gson.Gson;
import com.scwang.smartrefresh.layout.SmartRefreshLayout;
import com.scwang.smartrefresh.layout.api.RefreshLayout;
import com.scwang.smartrefresh.layout.listener.OnRefreshListener;

import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;
import org.json.JSONException;
import org.json.JSONObject;

import java.io.File;
import java.io.IOException;
import java.net.URI;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.TimeUnit;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import okhttp3.Call;
import okhttp3.Callback;
import okhttp3.MediaType;
import okhttp3.MultipartBody;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.RequestBody;
import okhttp3.Response;

public class OutLineActivity extends BaseActivity {
    @BindView(R.id.tv_title)
    TextView tvTitle;
    @BindView(R.id.refreshLayout1)
    SmartRefreshLayout refreshLayout1;
    @BindView(R.id.tv_right_text)
    TextView tvightText;
    @BindView(R.id.tv_table)
    TextView tvTable;
    @BindView(R.id.tv_type)
    TextView tvType;
    @BindView(R.id.recycle_db)
    RecyclerView recycleDb;
    @BindView(R.id.ll_btn)
    LinearLayout llBtn;
    @BindView(R.id.btn_about_task)
    Button btnAboutTask;
    @BindView(R.id.btn_delete)
    Button btnDelete;
    private List<LocalBean> lcalDatas = new ArrayList<>();
    private LocalLineAdapter localAdapter;
    private String typeName;
    private String selectTableId = "1";

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_out_line);
        ButterKnife.bind(this);
        EventBus.getDefault().register(this);
        init();
    }

    @Override
    protected void onResume() {
        super.onResume();
        getLocalData();
    }

    private void init() {
        tvTitle.setText(" 离线表单列表");
        tvightText.setText("多选");
        recycleDb.setLayoutManager(new LinearLayoutManager(this));
        recycleDb.addItemDecoration(new DividerItemDecoration(this, LinearLayoutManager.VERTICAL));
        localAdapter = new LocalLineAdapter(this, lcalDatas);
        recycleDb.setAdapter(localAdapter);
        localAdapter.setOnItemClickListener(new LocalLineAdapter.OnItemClickListener() {
            @Override
            public void onItemClick(int position) {
                // jumpTableDetail(position, "1");
            }

            @Override
            public void onCheck(int position) {
                lcalDatas.get(position).setCheck(!lcalDatas.get(position).isCheck());
                localAdapter.notifyDataSetChanged();
            }

            @Override
            public void onDelete(int position) {
                //根据ID删除本地数据库数据
                deletePosition(lcalDatas.get(position).get_id());
                getLocalData();
            }

            @Override
            public void onEdit(int position) {
                jumpLocalData(position);
            }
        });
        refreshLayout1.setOnRefreshListener(new OnRefreshListener() {
            @Override
            public void onRefresh(RefreshLayout refreshlayout) {
                getLocalData();
            }
        });
    }

    private void jumpLocalData(int position) {
        Intent intent;
        switch (selectTableId) {
            case "1":
                intent = new Intent(activity, GeologicalSvyPlanningLineActivity.class);
                break;
            case "2":
                intent = new Intent(activity, GeologicalSvyPlanningPtActivity.class);
                break;
            case "3":
                intent = new Intent(activity, FaultSvyPointActivity.class);
                break;
            case "4":
                intent = new Intent(activity, GeoGeomorphySvyPointActivity.class);
                break;
            case "5":
                intent = new Intent(activity, GeologicalSvyLineActivity.class);
                break;
            case "6":
                intent = new Intent(activity, GeologicalSvyPointActivity.class);
                break;
            case "7":
                intent = new Intent(activity, StratigraphySvyPointActivity.class);
                break;
            case "8":
                intent = new Intent(activity, TanCaodianActivity.class);
                break;
            case "9":
                intent = new Intent(activity, GeomorphySvyLineActivity.class);
                break;
            case "10":
                intent = new Intent(activity, GeomorphySvyPointActivity.class);
                break;
            case "11":
                intent = new Intent(activity, GeomorphySvyRegionActivity.class);
                break;
            case "12":
                intent = new Intent(activity, GeomorphySvyReProfActivity.class);
                break;
            case "13":
                intent = new Intent(activity, GeomorphySvySamplePointActivity.class);
                break;
            case "14":
                intent = new Intent(activity, GeomorStationActivity.class);
                break;
            case "15":
                intent = new Intent(activity, DrillHoleActivity.class);
                break;
            case "16":
                intent = new Intent(activity, SamplePointActivity.class);
                break;
            case "17":
                //todo 没测试
                intent = new Intent(activity, GeophySvyLineActivity.class);
                break;
            case "18":
                //todo 没测试
                intent = new Intent(activity, GeophySvyPointActivity.class);
                break;
            case "19":
                //todo 没测试
                intent = new Intent(activity, GeochemicalSvyLineActivity.class);
                break;
            case "20":
                intent = new Intent(activity, GeochemicalSvyPointActivity.class);
                break;
            case "21":
                intent = new Intent(activity, CraterActivity.class);
                break;
            case "22":
                intent = new Intent(activity, LavaActivity.class);
                break;
            case "23":
                intent = new Intent(activity, VolcanicSamplePointActivity.class);
                break;
            default:
                intent = new Intent(activity, TrajectoryActivity.class);
                break;
        }
        intent.putExtra("joninType", 2);
        intent.putExtra("isOnLine", false);
        intent.putExtra("_id", lcalDatas.get(position).get_id());
        activity.startActivity(intent);
    }

    private boolean isEdit = false;

    @OnClick({R.id.iv_back, R.id.tv_right_text, R.id.tv_table, R.id.tv_type, R.id.btn_about_task, R.id.btn_delete})
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.iv_back:
                finish();
                break;
            case R.id.tv_right_text:
                localAdapter.setIsEdit(!isEdit);
                isEdit = !isEdit;
                if (isEdit) {
                    tvightText.setText("取消");
                    llBtn.setVisibility(View.VISIBLE);
                    if (selectTableId.equals("25")) {
                        btnAboutTask.setText("批量上传");
                    } else {
                        btnAboutTask.setText("关联任务");
                    }
                } else {
                    tvightText.setText("多选");
                    llBtn.setVisibility(View.GONE);
                }
                break;
            case R.id.tv_table:
                SelectTypeFragmentDialog.newInstance(2, typeName).show(getSupportFragmentManager(), "");
                break;
            case R.id.tv_type:
                SelectTypeFragmentDialog.newInstance(1, typeName, true).show(getSupportFragmentManager(), "");
                break;
            case R.id.btn_about_task:
                //弹出弹窗
                if ("25".equals(selectTableId)) {
                    for (LocalBean localBean : lcalDatas) {
                        if (localBean.isCheck()) {
                            submitLocationAndDelete(localBean.get_id());
                            //网络请求上传
                            //网络请求删除
                            deletePosition(localBean.get_id());
                        }
                    }
                    getLocalData();
                    localAdapter.notifyDataSetChanged();
                } else {
                    OutLineAboutTaskFragmentDialog.newInstance().show(getSupportFragmentManager(), "");
                }
                break;
            case R.id.btn_delete:
                //本地删除
                for (LocalBean localBean : lcalDatas) {
                    if (localBean.isCheck()) {
                        deletePosition(localBean.get_id());
                    }
                }
                getLocalData();
                localAdapter.notifyDataSetChanged();
                break;
        }
    }

    private void submitLocationAndDelete(long id) {
        List<LocationEntity> locationEntities =
                BaseApplication.getInstance().getDaoSession().loadAll(LocationEntity.class);
        for (LocationEntity locationEntity : locationEntities) {
            if (id == locationEntity.get_id()) {
                submitLocation(locationEntity);
            }
        }
    }

    private Dialog myDialog;

    private void submitLocation(LocationEntity locationEntity1) {
        JsonBuilder jsonBuilder = new JsonBuilder(this);
        jsonBuilder.put("startTime", locationEntity1.getStartTime());
        jsonBuilder.put("lonlatArray", locationEntity1.getPoint());
        jsonBuilder.put("endTime", locationEntity1.getEndTime());
        jsonBuilder.put("taskId", locationEntity1.getTaskId());
        jsonBuilder.put("userId", locationEntity1.getUserId());
        jsonBuilder.put("createUser", locationEntity1.getUserId());

        MyHttpClient
                .newBuilder()
                .post()
                .url(Api.HDDC_CJ_HISTORY_POINTS)
                .addParam(jsonBuilder.toJsonString())
                .build()
                .enqueue(new BaseCallBack<LoginBean>() {
                    @Override
                    public void onSuccess(LoginBean bean) {
                        super.onSuccess(bean);
                        if (bean.getCode() == 200) {
                            try {
                                BaseApplication.getInstance().getDaoSession().delete(locationEntity1);
                                getLocalData();
                            } catch (Exception e) {
                                e.printStackTrace();
                            }
                            CustomToast.showToast(OutLineActivity.this, "提交成功");
                        }
                        if (myDialog != null)
                            myDialog.dismiss();
                    }

                    @Override
                    public void onFailure(Call call, IOException e) {
                        super.onFailure(call, e);
                        if (myDialog != null)
                            myDialog.dismiss();
                        CustomToast.showToast(OutLineActivity.this, "网络异常");
                    }

                    @Override
                    public void onError(int code) {
                        super.onError(code);
                        if (myDialog != null)
                            myDialog.dismiss();
                        CustomToast.showToast(OutLineActivity.this, "网络异常");
                    }
                });
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        EventBus.getDefault().unregister(this);
    }

    @Subscribe(threadMode = ThreadMode.MAIN)
    public void receiveMessage(MessageEvent json) {
        typeName = json.getType();
        tvType.setText(json.getType());
        tvTable.setText(json.getTableName());
        selectTableId = json.getTableId();
        getLocalData();
    }

    private int submitDataNum = 0;

    @Subscribe(threadMode = ThreadMode.MAIN)
    public void receiveMeage(AboutTaskEvent json) {
        String projectId = json.getProjectId();
        String taskId = json.getTableId();
        int code = json.getCode();
        if (2 == code) {
            //批量提交
            setSubmitNumber();
            if (myDialog == null) {
                myDialog = DialogUtils.showRefreshDialog(activity);
            } else {
                myDialog.show();
            }
            for (int i = 0; i < lcalDatas.size(); i++) {
                if (lcalDatas.get(i).isCheck()) {
                    List<Uri> list = getImageUri(lcalDatas.get(i).get_id());
                    if (list.size() > 0){
                        uploadImage(list, projectId, taskId, lcalDatas.get(i).get_id());
                    }else {
                        submitAll(projectId, taskId, lcalDatas.get(i).get_id(), "");
                    }
                }
            }
        } else {
            setValueAndReplace(projectId, taskId);
            getLocalData();
        }
    }

    private List<Uri> getImageUri(Long id) {
        List<Uri> imageUrl = new ArrayList<>();
        switch (selectTableId) {
            case "1":
                List<GeologicalSvyPlanningLineDbEntity> students = BaseApplication.getInstance().getDaoSession().loadAll(GeologicalSvyPlanningLineDbEntity.class);
                imageUrl.clear();
                for (GeologicalSvyPlanningLineDbEntity student : students) {
                    if (id != student.get_id()) {
                        continue;
                    }
                    if (TextUtils.isEmpty(student.getExtends7())){
                        continue;
                    }
                    String[] arr = student.getExtends7().split(",");
                    for (int i = 0; i < arr.length; i++) {
                        File file = new File(arr[i]);
                        Uri uri = Uri.fromFile(file);
                        imageUrl.add(uri);
                    }
                }
                break;
            case "2":
                List<GeologicalSvyPlanningPtDbEntity> geologicalSvyPlanningPtDbEntities = BaseApplication.getInstance().getDaoSession().loadAll(GeologicalSvyPlanningPtDbEntity.class);
                imageUrl.clear();
                for (GeologicalSvyPlanningPtDbEntity student : geologicalSvyPlanningPtDbEntities) {
                    if (id != student.get_id()) {
                        continue;
                    }
                    if (TextUtils.isEmpty(student.getExtends7())){
                        continue;
                    }
                    String[] arr = student.getExtends7().split(",");
                    for (int i = 0; i < arr.length; i++) {
                        File file = new File(arr[i]);
                        Uri uri = Uri.fromFile(file);
                        imageUrl.add(uri);
                    }
                }
                break;
            case "3":
                List<FaultSvyPointDbEntity> faultSvyPointDbEntities = BaseApplication.getInstance().getDaoSession().loadAll(FaultSvyPointDbEntity.class);
                imageUrl.clear();
                for (FaultSvyPointDbEntity student : faultSvyPointDbEntities) {
                    if (id != student.get_id()) {
                        continue;
                    }
                    if (TextUtils.isEmpty(student.getExtends7())){
                        continue;
                    }
                    String[] arr = student.getExtends7().split(",");
                    for (int i = 0; i < arr.length; i++) {
                        File file = new File(arr[i]);
                        Uri uri = Uri.fromFile(file);
                        imageUrl.add(uri);
                    }
                }
                break;
            case "4":
                List<GeoGeomorphySvyPointDbEntity> geoGeomorphySvyPointDbEntities
                        = BaseApplication.getInstance().getDaoSession().loadAll(GeoGeomorphySvyPointDbEntity.class);
                imageUrl.clear();
                for (GeoGeomorphySvyPointDbEntity student : geoGeomorphySvyPointDbEntities) {
                    if (id != student.get_id()) {
                        continue;
                    }
                    if (TextUtils.isEmpty(student.getExtends7())){
                        continue;
                    }
                    String[] arr = student.getExtends7().split(",");
                    for (int i = 0; i < arr.length; i++) {
                        File file = new File(arr[i]);
                        Uri uri = Uri.fromFile(file);
                        imageUrl.add(uri);
                    }
                }
                break;
            case "5":
                List<GeologicalSvyLineDbEntitiy> geologicalSvyLineDbEntitiys
                        = BaseApplication.getInstance().getDaoSession().loadAll(GeologicalSvyLineDbEntitiy.class);
                imageUrl.clear();
                for (GeologicalSvyLineDbEntitiy student : geologicalSvyLineDbEntitiys) {
                    if (id != student.get_id()) {
                        continue;
                    }
                    if (TextUtils.isEmpty(student.getExtends7())){
                        continue;
                    }
                    String[] arr = student.getExtends7().split(",");
                    for (int i = 0; i < arr.length; i++) {
                        File file = new File(arr[i]);
                        Uri uri = Uri.fromFile(file);
                        imageUrl.add(uri);
                    }
                }
                break;
            case "6":
                List<GeologicalSvyPointDbEntity> geologicalSvyPointDbEntities
                        = BaseApplication.getInstance().getDaoSession().loadAll(GeologicalSvyPointDbEntity.class);
                imageUrl.clear();
                for (GeologicalSvyPointDbEntity student : geologicalSvyPointDbEntities) {
                    if (id != student.get_id()) {
                        continue;
                    }
                    if (TextUtils.isEmpty(student.getExtends7())){
                        continue;
                    }
                    String[] arr = student.getExtends7().split(",");
                    for (int i = 0; i < arr.length; i++) {
                        File file = new File(arr[i]);
                        Uri uri = Uri.fromFile(file);
                        imageUrl.add(uri);
                    }
                }
                break;
            case "7":
                List<StratigraphySvyPointDbEntity> stratigraphySvyPointDbEntities
                        = BaseApplication.getInstance().getDaoSession().loadAll(StratigraphySvyPointDbEntity.class);
                imageUrl.clear();
                for (StratigraphySvyPointDbEntity student : stratigraphySvyPointDbEntities) {
                    if (id != student.get_id()) {
                        continue;
                    }
                    if (TextUtils.isEmpty(student.getExtends7())){
                        continue;
                    }
                    String[] arr = student.getExtends7().split(",");
                    for (int i = 0; i < arr.length; i++) {
                        File file = new File(arr[i]);
                        Uri uri = Uri.fromFile(file);
                        imageUrl.add(uri);
                    }
                }
                break;
            case "8":
                List<TanCaodianDbEntity> tanCaodianDbEntities
                        = BaseApplication.getInstance().getDaoSession().loadAll(TanCaodianDbEntity.class);
                imageUrl.clear();
                for (TanCaodianDbEntity student : tanCaodianDbEntities) {
                    if (id != student.get_id()) {
                        continue;
                    }
                    if (TextUtils.isEmpty(student.getExtends7())){
                        continue;
                    }
                    String[] arr = student.getExtends7().split(",");
                    for (int i = 0; i < arr.length; i++) {
                        File file = new File(arr[i]);
                        Uri uri = Uri.fromFile(file);
                        imageUrl.add(uri);
                    }
                }
                break;
            case "9":
                List<GeomorphySvyLineDbEntity> geomorphySvyLineDbEntities
                        = BaseApplication.getInstance().getDaoSession().loadAll(GeomorphySvyLineDbEntity.class);
                imageUrl.clear();
                for (GeomorphySvyLineDbEntity student : geomorphySvyLineDbEntities) {
                    if (id != student.get_id()) {
                        continue;
                    }
                    if (TextUtils.isEmpty(student.getExtends7())){
                        continue;
                    }
                    String[] arr = student.getExtends7().split(",");
                    for (int i = 0; i < arr.length; i++) {
                        File file = new File(arr[i]);
                        Uri uri = Uri.fromFile(file);
                        imageUrl.add(uri);
                    }
                }
                break;
            case "10":
                List<GeomorphySvyPointDbEntity> geomorphySvyPointDbEntities
                        = BaseApplication.getInstance().getDaoSession().loadAll(GeomorphySvyPointDbEntity.class);
                imageUrl.clear();
                for (GeomorphySvyPointDbEntity student : geomorphySvyPointDbEntities) {
                    if (id != student.get_id()) {
                        continue;
                    }
                    if (TextUtils.isEmpty(student.getExtends7())){
                        continue;
                    }
                    String[] arr = student.getExtends7().split(",");
                    for (int i = 0; i < arr.length; i++) {
                        File file = new File(arr[i]);
                        Uri uri = Uri.fromFile(file);
                        imageUrl.add(uri);
                    }
                }
                break;
            case "11":
                List<GeomorphySvyRegionDbEntity> geomorphySvyRegionDbEntities
                        = BaseApplication.getInstance().getDaoSession().loadAll(GeomorphySvyRegionDbEntity.class);
                imageUrl.clear();
                for (GeomorphySvyRegionDbEntity student : geomorphySvyRegionDbEntities) {
                    if (id != student.get_id()) {
                        continue;
                    }
                    if (TextUtils.isEmpty(student.getExtends7())){
                        continue;
                    }
                    String[] arr = student.getExtends7().split(",");
                    for (int i = 0; i < arr.length; i++) {
                        File file = new File(arr[i]);
                        Uri uri = Uri.fromFile(file);
                        imageUrl.add(uri);
                    }
                }
                break;
            case "12":
                List<GeomorphySvyReProfDbEntity> geomorphySvyReProfDbEntities
                        = BaseApplication.getInstance().getDaoSession().loadAll(GeomorphySvyReProfDbEntity.class);
                imageUrl.clear();
                for (GeomorphySvyReProfDbEntity student : geomorphySvyReProfDbEntities) {
                    if (id != student.get_id()) {
                        continue;
                    }
                    if (TextUtils.isEmpty(student.getExtends7())){
                        continue;
                    }
                    String[] arr = student.getExtends7().split(",");
                    for (int i = 0; i < arr.length; i++) {
                        File file = new File(arr[i]);
                        Uri uri = Uri.fromFile(file);
                        imageUrl.add(uri);
                    }
                }
                break;
            case "13":
                List<GeomorphySvySamplePointDbEntity> geomorphySvySamplePointDbEntities
                        = BaseApplication.getInstance().getDaoSession().loadAll(GeomorphySvySamplePointDbEntity.class);
                imageUrl.clear();
                for (GeomorphySvySamplePointDbEntity student : geomorphySvySamplePointDbEntities) {
                    if (id != student.get_id()) {
                        continue;
                    }
                    if (TextUtils.isEmpty(student.getExtends7())){
                        continue;
                    }
                    String[] arr = student.getExtends7().split(",");
                    for (int i = 0; i < arr.length; i++) {
                        File file = new File(arr[i]);
                        Uri uri = Uri.fromFile(file);
                        imageUrl.add(uri);
                    }
                }
                break;
            case "14":
                List<GeomorStationDbEntity> geomorStationDbEntities
                        = BaseApplication.getInstance().getDaoSession().loadAll(GeomorStationDbEntity.class);
                imageUrl.clear();
                for (GeomorStationDbEntity student : geomorStationDbEntities) {
                    if (id != student.get_id()) {
                        continue;
                    }
                    if (TextUtils.isEmpty(student.getExtends7())){
                        continue;
                    }
                    String[] arr = student.getExtends7().split(",");
                    for (int i = 0; i < arr.length; i++) {
                        File file = new File(arr[i]);
                        Uri uri = Uri.fromFile(file);
                        imageUrl.add(uri);
                    }
                }
                break;
            case "15":
                List<DrillHoleDbEntity> drillHoleDbEntities
                        = BaseApplication.getInstance().getDaoSession().loadAll(DrillHoleDbEntity.class);
                imageUrl.clear();
                for (DrillHoleDbEntity student : drillHoleDbEntities) {
                    if (id != student.get_id()) {
                        continue;
                    }
                    if (TextUtils.isEmpty(student.getExtends7())){
                        continue;
                    }
                    String[] arr = student.getExtends7().split(",");
                    for (int i = 0; i < arr.length; i++) {
                        File file = new File(arr[i]);
                        Uri uri = Uri.fromFile(file);
                        imageUrl.add(uri);
                    }
                }
                break;
            case "16":
                List<SamplePointDbEntity> samplePointDbEntities
                        = BaseApplication.getInstance().getDaoSession().loadAll(SamplePointDbEntity.class);
                imageUrl.clear();
                for (SamplePointDbEntity student : samplePointDbEntities) {
                    if (id != student.get_id()) {
                        continue;
                    }
                    if (TextUtils.isEmpty(student.getExtends7())){
                        continue;
                    }
                    String[] arr = student.getExtends7().split(",");
                    for (int i = 0; i < arr.length; i++) {
                        File file = new File(arr[i]);
                        Uri uri = Uri.fromFile(file);
                        imageUrl.add(uri);
                    }
                }
                break;
            case "17":
                List<GeophySvyLineDbEntity> geophySvyLineDbEntities
                        = BaseApplication.getInstance().getDaoSession().loadAll(GeophySvyLineDbEntity.class);
                imageUrl.clear();
                for (GeophySvyLineDbEntity student : geophySvyLineDbEntities) {
                    if (id != student.get_id()) {
                        continue;
                    }
                    if (TextUtils.isEmpty(student.getExtends7())){
                        continue;
                    }
                    String[] arr = student.getExtends7().split(",");
                    for (int i = 0; i < arr.length; i++) {
                        File file = new File(arr[i]);
                        Uri uri = Uri.fromFile(file);
                        imageUrl.add(uri);
                    }
                }
                break;
            case "18":
                List<GeophySvyPointDbEntity> geophySvyPointDbEntities
                        = BaseApplication.getInstance().getDaoSession().loadAll(GeophySvyPointDbEntity.class);
                imageUrl.clear();
                for (GeophySvyPointDbEntity student : geophySvyPointDbEntities) {
                    if (id != student.get_id()) {
                        continue;
                    }
                    if (TextUtils.isEmpty(student.getExtends7())){
                        continue;
                    }
                    String[] arr = student.getExtends7().split(",");
                    for (int i = 0; i < arr.length; i++) {
                        File file = new File(arr[i]);
                        Uri uri = Uri.fromFile(file);
                        imageUrl.add(uri);
                    }
                }
                break;
            case "19":
                List<GeochemicalSvyLineDbEntity> geochemicalSvyLineDbEntities
                        = BaseApplication.getInstance().getDaoSession().loadAll(GeochemicalSvyLineDbEntity.class);
                imageUrl.clear();
                for (GeochemicalSvyLineDbEntity student : geochemicalSvyLineDbEntities) {
                    if (id != student.get_id()) {
                        continue;
                    }
                    if (TextUtils.isEmpty(student.getExtends7())){
                        continue;
                    }
                    String[] arr = student.getExtends7().split(",");
                    for (int i = 0; i < arr.length; i++) {
                        File file = new File(arr[i]);
                        Uri uri = Uri.fromFile(file);
                        imageUrl.add(uri);
                    }
                }
                break;
            case "20":
                List<GeochemicalSvyPointDbEntity> geochemicalSvyPointDbEntities
                        = BaseApplication.getInstance().getDaoSession().loadAll(GeochemicalSvyPointDbEntity.class);
                imageUrl.clear();
                for (GeochemicalSvyPointDbEntity student : geochemicalSvyPointDbEntities) {
                    if (id != student.get_id()) {
                        continue;
                    }
                    if (TextUtils.isEmpty(student.getExtends7())){
                        continue;
                    }
                    String[] arr = student.getExtends7().split(",");
                    for (int i = 0; i < arr.length; i++) {
                        File file = new File(arr[i]);
                        Uri uri = Uri.fromFile(file);
                        imageUrl.add(uri);
                    }
                }
                break;
            case "21":
                List<CreaterDbEntity> createrDbEntities
                        = BaseApplication.getInstance().getDaoSession().loadAll(CreaterDbEntity.class);
                imageUrl.clear();
                for (CreaterDbEntity student : createrDbEntities) {
                    if (id != student.get_id()) {
                        continue;
                    }
                    if (TextUtils.isEmpty(student.getExtends7())){
                        continue;
                    }
                    String[] arr = student.getExtends7().split(",");
                    for (int i = 0; i < arr.length; i++) {
                        File file = new File(arr[i]);
                        Uri uri = Uri.fromFile(file);
                        imageUrl.add(uri);
                    }
                }
                break;
            case "22":
                List<LavaDbEntity> lavaDbEntities
                        = BaseApplication.getInstance().getDaoSession().loadAll(LavaDbEntity.class);
                imageUrl.clear();
                for (LavaDbEntity student : lavaDbEntities) {
                    if (id != student.get_id()) {
                        continue;
                    }
                    if (TextUtils.isEmpty(student.getExtends7())){
                        continue;
                    }
                    String[] arr = student.getExtends7().split(",");
                    for (int i = 0; i < arr.length; i++) {
                        File file = new File(arr[i]);
                        Uri uri = Uri.fromFile(file);
                        imageUrl.add(uri);
                    }
                }
                break;
            case "23":
                List<VolcanicSamplePointDbEntity> volcanicSamplePointDbEntities
                        = BaseApplication.getInstance().getDaoSession().loadAll(VolcanicSamplePointDbEntity.class);
                imageUrl.clear();
                for (VolcanicSamplePointDbEntity student : volcanicSamplePointDbEntities) {
                    if (id != student.get_id()) {
                        continue;
                    }
                    if (TextUtils.isEmpty(student.getExtends7())){
                        continue;
                    }
                    String[] arr = student.getExtends7().split(",");
                    for (int i = 0; i < arr.length; i++) {
                        File file = new File(arr[i]);
                        Uri uri = Uri.fromFile(file);
                        imageUrl.add(uri);
                    }
                }
                break;
            case "24":
                lcalDatas.clear();
                List<VolcanicSvyPointDbEntity> volcanicSvyPointDbEntities
                        = BaseApplication.getInstance().getDaoSession().loadAll(VolcanicSvyPointDbEntity.class);
                imageUrl.clear();
                for (VolcanicSvyPointDbEntity student : volcanicSvyPointDbEntities) {
                    if (id != student.get_id()) {
                        continue;
                    }
                    if (TextUtils.isEmpty(student.getExtends7())){
                        continue;
                    }
                    String[] arr = student.getExtends7().split(",");
                    for (int i = 0; i < arr.length; i++) {
                        File file = new File(arr[i]);
                        Uri uri = Uri.fromFile(file);
                        imageUrl.add(uri);
                    }
                }
                break;
        }
        return imageUrl;
    }

    private void setSubmitNumber() {
        for (int i = 0; i < lcalDatas.size(); i++) {
            if (lcalDatas.get(i).isCheck()) {
                submitDataNum++;
            }
        }
    }

    public void uploadImage(List<Uri> list, String projectId, String taskId, Long id) {
        MultipartBody.Builder mbody = new MultipartBody.Builder().setType(MultipartBody.FORM);
        for (int i = 0; i < list.size(); i++) {
            try {
                RequestBody requestBody = RequestBody.create(MediaType.parse("image/jpg"), FileUtil.uriToFile(list.get(i), activity));
                String filename = "img_" + System.currentTimeMillis() + ".jpg";
                mbody.addFormDataPart("multipartFiles", filename, requestBody);
            } catch (Exception e) {
                e.printStackTrace();
            }

        }
        mbody.addFormDataPart("type", selectTableId + "");
        mbody.setType(MultipartBody.FORM);
        RequestBody requestBody = mbody.build();
        final Request request = new Request.Builder()
                .url(Api.UPLOADIMAGES)
                .post(requestBody)
                .build();
        Log.e("wangchao",Api.UPLOADIMAGES);
        OkHttpClient.Builder httpBuilder = new OkHttpClient.Builder();
        httpBuilder.readTimeout(20000, TimeUnit.SECONDS)
                .connectTimeout(20000, TimeUnit.SECONDS)
                .writeTimeout(20000, TimeUnit.SECONDS)
        ;
        OkHttpClient okHttpClient = httpBuilder.build();
        okHttpClient.newCall(request).
                enqueue(new Callback() {
                    @Override
                    public void onFailure(Call call, IOException e) {
                        Toast.makeText(activity,"图片上传失败",Toast.LENGTH_SHORT).show();
                        if (myDialog != null)
                            myDialog.dismiss();
                    }

                    @Override
                    public void onResponse(Call call, final Response response) throws IOException {
                        Log.e("wangchao","222222222222222");
                        if (response.isSuccessful()) {
                            String result = response.body().string();
                            try {
                                JSONObject jsonObject = new JSONObject(result);
                                int code = jsonObject.getInt("code");
                                if (code == 200) {
                                    String imageUrl = jsonObject.getString("data");
                                    submitAll(projectId, taskId, id, imageUrl);
                                } else {
                                    CustomToast.showToast(activity, "图片上传失败");
                                }
                            } catch (JSONException e) {
                                e.printStackTrace();
                                CustomToast.showToast(activity, "图片上传失败");

                            }

                            if (response.body() != null) {
                                response.body().close();
                            }
                        }
                    }
                });
    }

    private void submitAll(String projectId, String taskId, Long id, String imageUrl) {
        String url = "";
        String josnStr = "";
        switch (selectTableId) {
            case "1":
                url = Api.DZDCGHLX_1_SAVE;
                List<GeologicalSvyPlanningLineDbEntity> students = BaseApplication.getInstance().getDaoSession().loadAll(GeologicalSvyPlanningLineDbEntity.class);
                for (GeologicalSvyPlanningLineDbEntity student : students) {
                    if (student.get_id() == id) {
                        student.setProjectId(projectId);
                        student.setTaskId(taskId);
                        student.setUserId((String) SPUtil.get("userId", ""));
                        student.setType(selectTableId);
                        student.setCreateUser((String) SPUtil.get("userId", ""));
                        josnStr = new Gson().toJson(student);
                    }
                }
                break;
            case "2":
                url = Api.DZDCGHLD_SAVE;
                List<GeologicalSvyPlanningPtDbEntity> students2 = BaseApplication.getInstance().getDaoSession().loadAll(GeologicalSvyPlanningPtDbEntity.class);
                for (GeologicalSvyPlanningPtDbEntity student : students2) {
                    if (student.get_id() == id) {
                        student.setProjectId(projectId);
                        student.setTaskId(taskId);
                        student.setUserId((String) SPUtil.get("userId", ""));
                        student.setType(selectTableId);
                        student.setCreateUser((String) SPUtil.get("userId", ""));
                        josnStr = new Gson().toJson(student);
                    }
                }
                break;
            case "3":
                url = Api.DZDCGHLX_SAVE;
                List<FaultSvyPointDbEntity> students3 = BaseApplication.getInstance().getDaoSession().loadAll(FaultSvyPointDbEntity.class);
                for (FaultSvyPointDbEntity student : students3) {
                    if (student.get_id() == id) {
                        student.setProjectId(projectId);
                        student.setTaskId(taskId);
                        student.setUserId((String) SPUtil.get("userId", ""));
                        student.setType(selectTableId);
                        student.setCreateUser((String) SPUtil.get("userId", ""));
                        josnStr = new Gson().toJson(student);
                    }
                }
                break;
            case "4":
                url = Api.DCGCD_DICT_CODE_SAVE;
                List<GeoGeomorphySvyPointDbEntity> students4 = BaseApplication.getInstance().getDaoSession().loadAll(GeoGeomorphySvyPointDbEntity.class);
                for (GeoGeomorphySvyPointDbEntity student : students4) {
                    if (student.get_id() == id) {
                        student.setProjectId(projectId);
                        student.setTaskId(taskId);
                        student.setUserId((String) SPUtil.get("userId", ""));
                        student.setType(selectTableId);
                        student.setCreateUser((String) SPUtil.get("userId", ""));
                        josnStr = new Gson().toJson(student);
                    }
                }
                break;
            case "5":
                url = Api.LSVYLINES_SAVE;
                List<GeologicalSvyLineDbEntitiy> students5 = BaseApplication.getInstance().getDaoSession().loadAll(GeologicalSvyLineDbEntitiy.class);
                for (GeologicalSvyLineDbEntitiy student : students5) {
                    if (student.get_id() == id) {
                        student.setProjectId(projectId);
                        student.setTaskId(taskId);
                        student.setUserId((String) SPUtil.get("userId", ""));
                        student.setType(selectTableId);
                        student.setCreateUser((String) SPUtil.get("userId", ""));
                        josnStr = new Gson().toJson(student);
                    }
                }
                break;
            case "6":
                url = Api.HDD_GEO_POINT_SAVE;
                List<GeologicalSvyPointDbEntity> students6 = BaseApplication.getInstance().getDaoSession().loadAll(GeologicalSvyPointDbEntity.class);
                for (GeologicalSvyPointDbEntity student : students6) {
                    if (student.get_id() == id) {
                        student.setProjectId(projectId);
                        student.setTaskId(taskId);
                        student.setUserId((String) SPUtil.get("userId", ""));
                        student.setType(selectTableId);
                        student.setCreateUser((String) SPUtil.get("userId", ""));
                        josnStr = new Gson().toJson(student);
                    }
                }
                break;
            case "7":
                url = Api.HDD_START_POINT;
                List<StratigraphySvyPointDbEntity> students7 = BaseApplication.getInstance().getDaoSession().loadAll(StratigraphySvyPointDbEntity.class);
                for (StratigraphySvyPointDbEntity student : students7) {
                    if (student.get_id() == id) {
                        student.setProjectId(projectId);
                        student.setTaskId(taskId);
                        student.setUserId((String) SPUtil.get("userId", ""));
                        student.setType(selectTableId);
                        student.setCreateUser((String) SPUtil.get("userId", ""));
                        josnStr = new Gson().toJson(student);
                    }
                }
                break;
            case "8":
                url = Api.TCD_SAVE;
                List<TanCaodianDbEntity> students8 = BaseApplication.getInstance().getDaoSession().loadAll(TanCaodianDbEntity.class);
                for (TanCaodianDbEntity student : students8) {
                    if (student.get_id() == id) {
                        student.setProjectId(projectId);
                        student.setTaskId(taskId);
                        student.setUserId((String) SPUtil.get("userId", ""));
                        student.setType(selectTableId);
                        student.setCreateUser((String) SPUtil.get("userId", ""));
                        josnStr = new Gson().toJson(student);
                    }
                }
                break;
            case "9":
                url = Api.HDD_GEOMOR_LINES;
                List<GeomorphySvyLineDbEntity> students9 = BaseApplication.getInstance().getDaoSession().loadAll(GeomorphySvyLineDbEntity.class);
                for (GeomorphySvyLineDbEntity student : students9) {
                    if (student.get_id() == id) {
                        student.setProjectId(projectId);
                        student.setTaskId(taskId);
                        student.setUserId((String) SPUtil.get("userId", ""));
                        student.setType(selectTableId);
                        student.setCreateUser((String) SPUtil.get("userId", ""));
                        josnStr = new Gson().toJson(student);
                    }
                }
                break;
            case "10":
                url = Api.HDD_GEOMOR_POINTS;
                List<GeomorphySvyPointDbEntity> students10 = BaseApplication.getInstance().getDaoSession().loadAll(GeomorphySvyPointDbEntity.class);
                for (GeomorphySvyPointDbEntity student : students10) {
                    if (student.get_id() == id) {
                        student.setProjectId(projectId);
                        student.setTaskId(taskId);
                        student.setUserId((String) SPUtil.get("userId", ""));
                        student.setType(selectTableId);
                        student.setCreateUser((String) SPUtil.get("userId", ""));
                        josnStr = new Gson().toJson(student);
                    }
                }
                break;
            case "11":
                url = Api.HDD_GEOMOR_REGIONS;
                List<GeomorphySvyRegionDbEntity> students11 = BaseApplication.getInstance().getDaoSession().loadAll(GeomorphySvyRegionDbEntity.class);
                for (GeomorphySvyRegionDbEntity student : students11) {
                    if (student.get_id() == id) {
                        student.setProjectId(projectId);
                        student.setTaskId(taskId);
                        student.setUserId((String) SPUtil.get("userId", ""));
                        student.setType(selectTableId);
                        student.setCreateUser((String) SPUtil.get("userId", ""));
                        josnStr = new Gson().toJson(student);
                    }
                }
                break;
            case "12":
                url = Api.HDD_GEOMOR_REPROFS;
                List<GeomorphySvyReProfDbEntity> students12 = BaseApplication.getInstance().getDaoSession().loadAll(GeomorphySvyReProfDbEntity.class);
                for (GeomorphySvyReProfDbEntity student : students12) {
                    if (student.get_id() == id) {
                        student.setProjectId(projectId);
                        student.setTaskId(taskId);
                        student.setUserId((String) SPUtil.get("userId", ""));
                        student.setType(selectTableId);
                        student.setCreateUser((String) SPUtil.get("userId", ""));
                        josnStr = new Gson().toJson(student);
                    }
                }
                break;
            case "13":
                url = Api.HDD_GEOMOR_SAMPLE_POINTS;
                List<GeomorphySvySamplePointDbEntity> students13 = BaseApplication.getInstance().getDaoSession().loadAll(GeomorphySvySamplePointDbEntity.class);
                for (GeomorphySvySamplePointDbEntity student : students13) {
                    if (student.get_id() == id) {
                        student.setProjectId(projectId);
                        student.setTaskId(taskId);
                        student.setUserId((String) SPUtil.get("userId", ""));
                        student.setType(selectTableId);
                        student.setCreateUser((String) SPUtil.get("userId", ""));
                        josnStr = new Gson().toJson(student);
                    }
                }
                break;
            case "14":
                url = Api.HDD_GEOMOR_STATIONS;
                List<GeomorStationDbEntity> students14 = BaseApplication.getInstance().getDaoSession().loadAll(GeomorStationDbEntity.class);
                for (GeomorStationDbEntity student : students14) {
                    if (student.get_id() == id) {
                        student.setProjectId(projectId);
                        student.setTaskId(taskId);
                        student.setUserId((String) SPUtil.get("userId", ""));
                        student.setType(selectTableId);
                        student.setCreateUser((String) SPUtil.get("userId", ""));
                        josnStr = new Gson().toJson(student);
                    }
                }
                break;
            case "15":
                url = Api.HDD_DRILL_HOLES;
                List<DrillHoleDbEntity> students15 = BaseApplication.getInstance().getDaoSession().loadAll(DrillHoleDbEntity.class);
                for (DrillHoleDbEntity student : students15) {
                    if (student.get_id() == id) {
                        student.setProjectId(projectId);
                        student.setTaskId(taskId);
                        student.setUserId((String) SPUtil.get("userId", ""));
                        student.setType(selectTableId);
                        student.setCreateUser((String) SPUtil.get("userId", ""));
                        josnStr = new Gson().toJson(student);
                    }
                }
                break;
            case "16":
                url = Api.HDD_SAMPLE_POINTS;
                List<SamplePointDbEntity> students16 = BaseApplication.getInstance().getDaoSession().loadAll(SamplePointDbEntity.class);
                for (SamplePointDbEntity student : students16) {
                    if (student.get_id() == id) {
                        student.setProjectId(projectId);
                        student.setTaskId(taskId);
                        student.setUserId((String) SPUtil.get("userId", ""));
                        student.setType(selectTableId);
                        student.setCreateUser((String) SPUtil.get("userId", ""));
                        josnStr = new Gson().toJson(student);
                    }
                }
                break;
            case "17":
                url = Api.HDD_WY_GEO_LINES;
                List<GeophySvyLineDbEntity> students17 = BaseApplication.getInstance().getDaoSession().loadAll(GeophySvyLineDbEntity.class);
                for (GeophySvyLineDbEntity student : students17) {
                    if (student.get_id() == id) {
                        student.setProjectId(projectId);
                        student.setTaskId(taskId);
                        student.setUserId((String) SPUtil.get("userId", ""));
                        student.setType(selectTableId);
                        student.setCreateUser((String) SPUtil.get("userId", ""));
                        josnStr = new Gson().toJson(student);
                    }
                }
                break;
            case "18":
                url = Api.HDD_WY_GEOPHY_POINTS;
                List<GeophySvyPointDbEntity> students18 = BaseApplication.getInstance().getDaoSession().loadAll(GeophySvyPointDbEntity.class);
                for (GeophySvyPointDbEntity student : students18) {
                    if (student.get_id() == id) {
                        student.setProjectId(projectId);
                        student.setTaskId(taskId);
                        student.setUserId((String) SPUtil.get("userId", ""));
                        student.setType(selectTableId);
                        student.setCreateUser((String) SPUtil.get("userId", ""));
                        josnStr = new Gson().toJson(student);
                    }
                }
                break;
            case "19":
                url = Api.HDD_WY_GEOCHEMICAL_LINES;
                List<GeochemicalSvyLineDbEntity> students19 = BaseApplication.getInstance().getDaoSession().loadAll(GeochemicalSvyLineDbEntity.class);
                for (GeochemicalSvyLineDbEntity student : students19) {
                    if (student.get_id() == id) {
                        student.setProjectId(projectId);
                        student.setTaskId(taskId);
                        student.setUserId((String) SPUtil.get("userId", ""));
                        student.setType(selectTableId);
                        student.setCreateUser((String) SPUtil.get("userId", ""));
                        josnStr = new Gson().toJson(student);
                    }
                }
                break;
            case "20":
                url = Api.HDD_WY_POINTS;
                List<GeochemicalSvyPointDbEntity> students20 = BaseApplication.getInstance().getDaoSession().loadAll(GeochemicalSvyPointDbEntity.class);
                for (GeochemicalSvyPointDbEntity student : students20) {
                    if (student.get_id() == id) {
                        student.setProjectId(projectId);
                        student.setTaskId(taskId);
                        student.setUserId((String) SPUtil.get("userId", ""));
                        student.setType(selectTableId);
                        student.setCreateUser((String) SPUtil.get("userId", ""));
                        josnStr = new Gson().toJson(student);
                    }
                }
                break;
            case "21":
                url = Api.HDD_WY_CRATERS;
                List<CreaterDbEntity> students21 = BaseApplication.getInstance().getDaoSession().loadAll(CreaterDbEntity.class);
                for (CreaterDbEntity student : students21) {
                    if (student.get_id() == id) {
                        student.setProjectId(projectId);
                        student.setTaskId(taskId);
                        student.setUserId((String) SPUtil.get("userId", ""));
                        student.setType(selectTableId);
                        student.setCreateUser((String) SPUtil.get("userId", ""));
                        josnStr = new Gson().toJson(student);
                    }
                }
                break;
            case "22":
                url = Api.HDD_WY_LAVAS;
                List<LavaDbEntity> students22 = BaseApplication.getInstance().getDaoSession().loadAll(LavaDbEntity.class);
                for (LavaDbEntity student : students22) {
                    if (student.get_id() == id) {
                        student.setProjectId(projectId);
                        student.setTaskId(taskId);
                        student.setUserId((String) SPUtil.get("userId", ""));
                        student.setType(selectTableId);
                        student.setCreateUser((String) SPUtil.get("userId", ""));
                        josnStr = new Gson().toJson(student);
                    }
                }
                break;
            case "23":
                url = Api.HDD_VOLCAIC_SAMPLE;
                List<VolcanicSamplePointDbEntity> students23 = BaseApplication.getInstance().getDaoSession().loadAll(VolcanicSamplePointDbEntity.class);
                for (VolcanicSamplePointDbEntity student : students23) {
                    if (student.get_id() == id) {
                        student.setProjectId(projectId);
                        student.setTaskId(taskId);
                        student.setUserId((String) SPUtil.get("userId", ""));
                        student.setType(selectTableId);
                        student.setCreateUser((String) SPUtil.get("userId", ""));
                        josnStr = new Gson().toJson(student);
                    }
                }
                break;
            default:
                url = Api.HDD_VOLCANICS_POINTS;
                List<VolcanicSvyPointDbEntity> students24 = BaseApplication.getInstance().getDaoSession().loadAll(VolcanicSvyPointDbEntity.class);
                for (VolcanicSvyPointDbEntity student : students24) {
                    if (student.get_id() == id) {
                        student.setProjectId(projectId);
                        student.setTaskId(taskId);
                        student.setUserId((String) SPUtil.get("userId", ""));
                        student.setType(selectTableId);
                        student.setCreateUser((String) SPUtil.get("userId", ""));
                        josnStr = new Gson().toJson(student);
                    }
                }
                break;
        }

        MyHttpClient
                .newBuilder()
                .post()
                .url(url)
                .addParam(josnStr)
                .build()
                .enqueue(new BaseCallBack<LoginBean>() {
                    @Override
                    public void onSuccess(LoginBean bean) {
                        super.onSuccess(bean);
                        if (bean.getCode() == 200) {
                            deletePosition(id);
                            submitDataNum--;
                            if (0 == submitDataNum) {
                                getLocalData();
                                if (myDialog != null)
                                    myDialog.dismiss();
                            }
                        } else {
                            if (myDialog != null)
                                myDialog.dismiss();
                        }
                    }

                    @Override
                    public void onFailure(Call call, IOException e) {
                        super.onFailure(call, e);
                        if (myDialog != null)
                            myDialog.dismiss();
                        CustomToast.showToast(OutLineActivity.this, "网络异常");
                    }

                    @Override
                    public void onError(int code) {
                        super.onError(code);
                        if (myDialog != null)
                            myDialog.dismiss();
                        CustomToast.showToast(OutLineActivity.this, "网络异常");
                    }
                });
    }

    private void setValueAndReplace(String projectId, String taskId) {
        switch (selectTableId) {
            case "1":
                List<GeologicalSvyPlanningLineDbEntity> students = BaseApplication.getInstance().getDaoSession().loadAll(GeologicalSvyPlanningLineDbEntity.class);
                if (students.size() == 0) {
                    return;
                }
                for (int i = 0; i < lcalDatas.size(); i++) {
                    if (lcalDatas.get(i).isCheck()) {
                        for (GeologicalSvyPlanningLineDbEntity geologicalSvyPlanningLineDbEntity : students) {
                            if (lcalDatas.get(i).get_id() == geologicalSvyPlanningLineDbEntity.get_id()) {
                                geologicalSvyPlanningLineDbEntity.setProjectId(projectId);
                                geologicalSvyPlanningLineDbEntity.setTaskId(taskId);
                                BaseApplication.getInstance().getDaoSession().insertOrReplace(geologicalSvyPlanningLineDbEntity);
                            }
                        }
                    }
                }
                break;
            case "2":
                List<GeologicalSvyPlanningPtDbEntity> geologicalSvyPlanningPtDbEntities = BaseApplication.getInstance().getDaoSession().loadAll(GeologicalSvyPlanningPtDbEntity.class);
                if (geologicalSvyPlanningPtDbEntities.size() == 0) {
                    return;
                }
                for (int i = 0; i < lcalDatas.size(); i++) {
                    if (lcalDatas.get(i).isCheck()) {
                        for (GeologicalSvyPlanningPtDbEntity geologicalSvyPlanningLineDbEntity : geologicalSvyPlanningPtDbEntities) {
                            if (lcalDatas.get(i).get_id() == geologicalSvyPlanningLineDbEntity.get_id()) {
                                geologicalSvyPlanningLineDbEntity.setProjectId(projectId);
                                geologicalSvyPlanningLineDbEntity.setTaskId(taskId);
                                BaseApplication.getInstance().getDaoSession().insertOrReplace(geologicalSvyPlanningLineDbEntity);
                            }
                        }
                    }
                }
                break;
            case "3":
                List<FaultSvyPointDbEntity> faultSvyPointDbEntities = BaseApplication.getInstance().getDaoSession().loadAll(FaultSvyPointDbEntity.class);
                if (faultSvyPointDbEntities.size() == 0) {
                    return;
                }
                for (int i = 0; i < lcalDatas.size(); i++) {
                    if (lcalDatas.get(i).isCheck()) {
                        for (FaultSvyPointDbEntity geologicalSvyPlanningLineDbEntity : faultSvyPointDbEntities) {
                            if (lcalDatas.get(i).get_id() == geologicalSvyPlanningLineDbEntity.get_id()) {
                                geologicalSvyPlanningLineDbEntity.setProjectId(projectId);
                                geologicalSvyPlanningLineDbEntity.setTaskId(taskId);
                                BaseApplication.getInstance().getDaoSession().insertOrReplace(geologicalSvyPlanningLineDbEntity);
                            }
                        }
                    }
                }
                break;
            case "4":
                List<GeoGeomorphySvyPointDbEntity> geoGeomorphySvyPointDbEntities
                        = BaseApplication.getInstance().getDaoSession().loadAll(GeoGeomorphySvyPointDbEntity.class);
                if (geoGeomorphySvyPointDbEntities.size() == 0) {
                    return;
                }
                for (int i = 0; i < lcalDatas.size(); i++) {
                    if (lcalDatas.get(i).isCheck()) {
                        for (GeoGeomorphySvyPointDbEntity geologicalSvyPlanningLineDbEntity : geoGeomorphySvyPointDbEntities) {
                            if (lcalDatas.get(i).get_id() == geologicalSvyPlanningLineDbEntity.get_id()) {
                                geologicalSvyPlanningLineDbEntity.setProjectId(projectId);
                                geologicalSvyPlanningLineDbEntity.setTaskId(taskId);
                                BaseApplication.getInstance().getDaoSession().insertOrReplace(geologicalSvyPlanningLineDbEntity);
                            }
                        }
                    }
                }
                break;
            case "5":
                List<GeologicalSvyLineDbEntitiy> geologicalSvyLineDbEntitiys
                        = BaseApplication.getInstance().getDaoSession().loadAll(GeologicalSvyLineDbEntitiy.class);
                if (geologicalSvyLineDbEntitiys.size() == 0) {
                    return;
                }
                for (int i = 0; i < lcalDatas.size(); i++) {
                    if (lcalDatas.get(i).isCheck()) {
                        for (GeologicalSvyLineDbEntitiy geologicalSvyPlanningLineDbEntity : geologicalSvyLineDbEntitiys) {
                            if (lcalDatas.get(i).get_id() == geologicalSvyPlanningLineDbEntity.get_id()) {
                                geologicalSvyPlanningLineDbEntity.setProjectId(projectId);
                                geologicalSvyPlanningLineDbEntity.setTaskId(taskId);
                                BaseApplication.getInstance().getDaoSession().insertOrReplace(geologicalSvyPlanningLineDbEntity);
                            }
                        }
                    }
                }
                break;
            case "6":
                List<GeologicalSvyPointDbEntity> geologicalSvyPointDbEntities
                        = BaseApplication.getInstance().getDaoSession().loadAll(GeologicalSvyPointDbEntity.class);
                if (geologicalSvyPointDbEntities.size() == 0) {
                    return;
                }
                for (int i = 0; i < lcalDatas.size(); i++) {
                    if (lcalDatas.get(i).isCheck()) {
                        for (GeologicalSvyPointDbEntity geologicalSvyPlanningLineDbEntity : geologicalSvyPointDbEntities) {
                            if (lcalDatas.get(i).get_id() == geologicalSvyPlanningLineDbEntity.get_id()) {
                                geologicalSvyPlanningLineDbEntity.setProjectId(projectId);
                                geologicalSvyPlanningLineDbEntity.setTaskId(taskId);
                                BaseApplication.getInstance().getDaoSession().insertOrReplace(geologicalSvyPlanningLineDbEntity);
                            }
                        }
                    }
                }
                break;
            case "7":
                List<StratigraphySvyPointDbEntity> stratigraphySvyPointDbEntities
                        = BaseApplication.getInstance().getDaoSession().loadAll(StratigraphySvyPointDbEntity.class);
                if (stratigraphySvyPointDbEntities.size() == 0) {
                    return;
                }
                for (int i = 0; i < lcalDatas.size(); i++) {
                    if (lcalDatas.get(i).isCheck()) {
                        for (StratigraphySvyPointDbEntity geologicalSvyPlanningLineDbEntity : stratigraphySvyPointDbEntities) {
                            if (lcalDatas.get(i).get_id() == geologicalSvyPlanningLineDbEntity.get_id()) {
                                geologicalSvyPlanningLineDbEntity.setProjectId(projectId);
                                geologicalSvyPlanningLineDbEntity.setTaskId(taskId);
                                BaseApplication.getInstance().getDaoSession().insertOrReplace(geologicalSvyPlanningLineDbEntity);
                            }
                        }
                    }
                }
                break;
            case "8":
                List<TanCaodianDbEntity> tanCaodianDbEntities
                        = BaseApplication.getInstance().getDaoSession().loadAll(TanCaodianDbEntity.class);
                if (tanCaodianDbEntities.size() == 0) {
                    return;
                }
                for (int i = 0; i < lcalDatas.size(); i++) {
                    if (lcalDatas.get(i).isCheck()) {
                        for (TanCaodianDbEntity geologicalSvyPlanningLineDbEntity : tanCaodianDbEntities) {
                            if (lcalDatas.get(i).get_id() == geologicalSvyPlanningLineDbEntity.get_id()) {
                                geologicalSvyPlanningLineDbEntity.setProjectId(projectId);
                                geologicalSvyPlanningLineDbEntity.setTaskId(taskId);
                                BaseApplication.getInstance().getDaoSession().insertOrReplace(geologicalSvyPlanningLineDbEntity);
                            }
                        }
                    }
                }
                break;
            case "9":
                List<GeomorphySvyLineDbEntity> geomorphySvyLineDbEntities
                        = BaseApplication.getInstance().getDaoSession().loadAll(GeomorphySvyLineDbEntity.class);
                if (geomorphySvyLineDbEntities.size() == 0) {
                    return;
                }
                for (int i = 0; i < lcalDatas.size(); i++) {
                    if (lcalDatas.get(i).isCheck()) {
                        for (GeomorphySvyLineDbEntity geologicalSvyPlanningLineDbEntity : geomorphySvyLineDbEntities) {
                            if (lcalDatas.get(i).get_id() == geologicalSvyPlanningLineDbEntity.get_id()) {
                                geologicalSvyPlanningLineDbEntity.setProjectId(projectId);
                                geologicalSvyPlanningLineDbEntity.setTaskId(taskId);
                                BaseApplication.getInstance().getDaoSession().insertOrReplace(geologicalSvyPlanningLineDbEntity);
                            }
                        }
                    }
                }
                break;
            case "10":
                List<GeomorphySvyPointDbEntity> geomorphySvyPointDbEntities
                        = BaseApplication.getInstance().getDaoSession().loadAll(GeomorphySvyPointDbEntity.class);
                if (geomorphySvyPointDbEntities.size() == 0) {
                    return;
                }
                for (int i = 0; i < lcalDatas.size(); i++) {
                    if (lcalDatas.get(i).isCheck()) {
                        for (GeomorphySvyPointDbEntity geologicalSvyPlanningLineDbEntity : geomorphySvyPointDbEntities) {
                            if (lcalDatas.get(i).get_id() == geologicalSvyPlanningLineDbEntity.get_id()) {
                                geologicalSvyPlanningLineDbEntity.setProjectId(projectId);
                                geologicalSvyPlanningLineDbEntity.setTaskId(taskId);
                                BaseApplication.getInstance().getDaoSession().insertOrReplace(geologicalSvyPlanningLineDbEntity);
                            }
                        }
                    }
                }
                break;
            case "11":
                List<GeomorphySvyRegionDbEntity> geomorphySvyRegionDbEntities
                        = BaseApplication.getInstance().getDaoSession().loadAll(GeomorphySvyRegionDbEntity.class);
                if (geomorphySvyRegionDbEntities.size() == 0) {
                    return;
                }
                for (int i = 0; i < lcalDatas.size(); i++) {
                    if (lcalDatas.get(i).isCheck()) {
                        for (GeomorphySvyRegionDbEntity geologicalSvyPlanningLineDbEntity : geomorphySvyRegionDbEntities) {
                            if (lcalDatas.get(i).get_id() == geologicalSvyPlanningLineDbEntity.get_id()) {
                                geologicalSvyPlanningLineDbEntity.setProjectId(projectId);
                                geologicalSvyPlanningLineDbEntity.setTaskId(taskId);
                                BaseApplication.getInstance().getDaoSession().insertOrReplace(geologicalSvyPlanningLineDbEntity);
                            }
                        }
                    }
                }
                break;
            case "12":
                List<GeomorphySvyReProfDbEntity> geomorphySvyReProfDbEntities
                        = BaseApplication.getInstance().getDaoSession().loadAll(GeomorphySvyReProfDbEntity.class);
                if (geomorphySvyReProfDbEntities.size() == 0) {
                    return;
                }
                for (int i = 0; i < lcalDatas.size(); i++) {
                    if (lcalDatas.get(i).isCheck()) {
                        for (GeomorphySvyReProfDbEntity geologicalSvyPlanningLineDbEntity : geomorphySvyReProfDbEntities) {
                            if (lcalDatas.get(i).get_id() == geologicalSvyPlanningLineDbEntity.get_id()) {
                                geologicalSvyPlanningLineDbEntity.setProjectId(projectId);
                                geologicalSvyPlanningLineDbEntity.setTaskId(taskId);
                                BaseApplication.getInstance().getDaoSession().insertOrReplace(geologicalSvyPlanningLineDbEntity);
                            }
                        }
                    }
                }
                break;
            case "13":
                List<GeomorphySvySamplePointDbEntity> geomorphySvySamplePointDbEntities
                        = BaseApplication.getInstance().getDaoSession().loadAll(GeomorphySvySamplePointDbEntity.class);
                if (geomorphySvySamplePointDbEntities.size() == 0) {
                    return;
                }
                for (int i = 0; i < lcalDatas.size(); i++) {
                    if (lcalDatas.get(i).isCheck()) {
                        for (GeomorphySvySamplePointDbEntity geologicalSvyPlanningLineDbEntity : geomorphySvySamplePointDbEntities) {
                            if (lcalDatas.get(i).get_id() == geologicalSvyPlanningLineDbEntity.get_id()) {
                                geologicalSvyPlanningLineDbEntity.setProjectId(projectId);
                                geologicalSvyPlanningLineDbEntity.setTaskId(taskId);
                                BaseApplication.getInstance().getDaoSession().insertOrReplace(geologicalSvyPlanningLineDbEntity);
                            }
                        }
                    }
                }
                break;
            case "14":
                List<GeomorStationDbEntity> geomorStationDbEntities
                        = BaseApplication.getInstance().getDaoSession().loadAll(GeomorStationDbEntity.class);
                if (geomorStationDbEntities.size() == 0) {
                    return;
                }
                for (int i = 0; i < lcalDatas.size(); i++) {
                    if (lcalDatas.get(i).isCheck()) {
                        for (GeomorStationDbEntity geologicalSvyPlanningLineDbEntity : geomorStationDbEntities) {
                            if (lcalDatas.get(i).get_id() == geologicalSvyPlanningLineDbEntity.get_id()) {
                                geologicalSvyPlanningLineDbEntity.setProjectId(projectId);
                                geologicalSvyPlanningLineDbEntity.setTaskId(taskId);
                                BaseApplication.getInstance().getDaoSession().insertOrReplace(geologicalSvyPlanningLineDbEntity);
                            }
                        }
                    }
                }
                break;
            case "15":
                List<DrillHoleDbEntity> drillHoleDbEntities
                        = BaseApplication.getInstance().getDaoSession().loadAll(DrillHoleDbEntity.class);
                if (drillHoleDbEntities.size() == 0) {
                    return;
                }
                for (int i = 0; i < lcalDatas.size(); i++) {
                    if (lcalDatas.get(i).isCheck()) {
                        for (DrillHoleDbEntity geologicalSvyPlanningLineDbEntity : drillHoleDbEntities) {
                            if (lcalDatas.get(i).get_id() == geologicalSvyPlanningLineDbEntity.get_id()) {
                                geologicalSvyPlanningLineDbEntity.setProjectId(projectId);
                                geologicalSvyPlanningLineDbEntity.setTaskId(taskId);
                                BaseApplication.getInstance().getDaoSession().insertOrReplace(geologicalSvyPlanningLineDbEntity);
                            }
                        }
                    }
                }
                break;
            case "16":
                List<SamplePointDbEntity> samplePointDbEntities
                        = BaseApplication.getInstance().getDaoSession().loadAll(SamplePointDbEntity.class);
                if (samplePointDbEntities.size() == 0) {
                    return;
                }
                for (int i = 0; i < lcalDatas.size(); i++) {
                    if (lcalDatas.get(i).isCheck()) {
                        for (SamplePointDbEntity geologicalSvyPlanningLineDbEntity : samplePointDbEntities) {
                            if (lcalDatas.get(i).get_id() == geologicalSvyPlanningLineDbEntity.get_id()) {
                                geologicalSvyPlanningLineDbEntity.setProjectId(projectId);
                                geologicalSvyPlanningLineDbEntity.setTaskId(taskId);
                                BaseApplication.getInstance().getDaoSession().insertOrReplace(geologicalSvyPlanningLineDbEntity);
                            }
                        }
                    }
                }
                break;
            case "17":
                List<GeophySvyLineDbEntity> geophySvyLineDbEntities
                        = BaseApplication.getInstance().getDaoSession().loadAll(GeophySvyLineDbEntity.class);
                if (geophySvyLineDbEntities.size() == 0) {
                    return;
                }
                for (int i = 0; i < lcalDatas.size(); i++) {
                    if (lcalDatas.get(i).isCheck()) {
                        for (GeophySvyLineDbEntity geologicalSvyPlanningLineDbEntity : geophySvyLineDbEntities) {
                            if (lcalDatas.get(i).get_id() == geologicalSvyPlanningLineDbEntity.get_id()) {
                                geologicalSvyPlanningLineDbEntity.setProjectId(projectId);
                                geologicalSvyPlanningLineDbEntity.setTaskId(taskId);
                                BaseApplication.getInstance().getDaoSession().insertOrReplace(geologicalSvyPlanningLineDbEntity);
                            }
                        }
                    }
                }
                break;
            case "18":
                List<GeophySvyPointDbEntity> geophySvyPointDbEntities
                        = BaseApplication.getInstance().getDaoSession().loadAll(GeophySvyPointDbEntity.class);
                if (geophySvyPointDbEntities.size() == 0) {
                    return;
                }
                for (int i = 0; i < lcalDatas.size(); i++) {
                    if (lcalDatas.get(i).isCheck()) {
                        for (GeophySvyPointDbEntity geologicalSvyPlanningLineDbEntity : geophySvyPointDbEntities) {
                            if (lcalDatas.get(i).get_id() == geologicalSvyPlanningLineDbEntity.get_id()) {
                                geologicalSvyPlanningLineDbEntity.setProjectId(projectId);
                                geologicalSvyPlanningLineDbEntity.setTaskId(taskId);
                                BaseApplication.getInstance().getDaoSession().insertOrReplace(geologicalSvyPlanningLineDbEntity);
                            }
                        }
                    }
                }
                break;
            case "19":
                List<GeochemicalSvyLineDbEntity> geochemicalSvyLineDbEntities
                        = BaseApplication.getInstance().getDaoSession().loadAll(GeochemicalSvyLineDbEntity.class);
                if (geochemicalSvyLineDbEntities.size() == 0) {
                    return;
                }
                for (int i = 0; i < lcalDatas.size(); i++) {
                    if (lcalDatas.get(i).isCheck()) {
                        for (GeochemicalSvyLineDbEntity geologicalSvyPlanningLineDbEntity : geochemicalSvyLineDbEntities) {
                            if (lcalDatas.get(i).get_id() == geologicalSvyPlanningLineDbEntity.get_id()) {
                                geologicalSvyPlanningLineDbEntity.setProjectId(projectId);
                                geologicalSvyPlanningLineDbEntity.setTaskId(taskId);
                                BaseApplication.getInstance().getDaoSession().insertOrReplace(geologicalSvyPlanningLineDbEntity);
                            }
                        }
                    }
                }
                break;
            case "20":
                List<GeochemicalSvyPointDbEntity> geochemicalSvyPointDbEntities
                        = BaseApplication.getInstance().getDaoSession().loadAll(GeochemicalSvyPointDbEntity.class);
                if (geochemicalSvyPointDbEntities.size() == 0) {
                    return;
                }
                for (int i = 0; i < lcalDatas.size(); i++) {
                    if (lcalDatas.get(i).isCheck()) {
                        for (GeochemicalSvyPointDbEntity geologicalSvyPlanningLineDbEntity : geochemicalSvyPointDbEntities) {
                            if (lcalDatas.get(i).get_id() == geologicalSvyPlanningLineDbEntity.get_id()) {
                                geologicalSvyPlanningLineDbEntity.setProjectId(projectId);
                                geologicalSvyPlanningLineDbEntity.setTaskId(taskId);
                                BaseApplication.getInstance().getDaoSession().insertOrReplace(geologicalSvyPlanningLineDbEntity);
                            }
                        }
                    }
                }
                break;
            case "21":
                List<CreaterDbEntity> createrDbEntities
                        = BaseApplication.getInstance().getDaoSession().loadAll(CreaterDbEntity.class);
                if (createrDbEntities.size() == 0) {
                    return;
                }
                for (int i = 0; i < lcalDatas.size(); i++) {
                    if (lcalDatas.get(i).isCheck()) {
                        for (CreaterDbEntity geologicalSvyPlanningLineDbEntity : createrDbEntities) {
                            if (lcalDatas.get(i).get_id() == geologicalSvyPlanningLineDbEntity.get_id()) {
                                geologicalSvyPlanningLineDbEntity.setProjectId(projectId);
                                geologicalSvyPlanningLineDbEntity.setTaskId(taskId);
                                BaseApplication.getInstance().getDaoSession().insertOrReplace(geologicalSvyPlanningLineDbEntity);
                            }
                        }
                    }
                }
                break;
            case "22":
                List<LavaDbEntity> lavaDbEntities
                        = BaseApplication.getInstance().getDaoSession().loadAll(LavaDbEntity.class);
                if (lavaDbEntities.size() == 0) {
                    return;
                }
                for (int i = 0; i < lcalDatas.size(); i++) {
                    if (lcalDatas.get(i).isCheck()) {
                        for (LavaDbEntity geologicalSvyPlanningLineDbEntity : lavaDbEntities) {
                            if (lcalDatas.get(i).get_id() == geologicalSvyPlanningLineDbEntity.get_id()) {
                                geologicalSvyPlanningLineDbEntity.setProjectId(projectId);
                                geologicalSvyPlanningLineDbEntity.setTaskId(taskId);
                                BaseApplication.getInstance().getDaoSession().insertOrReplace(geologicalSvyPlanningLineDbEntity);
                            }
                        }
                    }
                }
                break;
            case "23":
                List<VolcanicSamplePointDbEntity> volcanicSamplePointDbEntities
                        = BaseApplication.getInstance().getDaoSession().loadAll(VolcanicSamplePointDbEntity.class);
                if (volcanicSamplePointDbEntities.size() == 0) {
                    return;
                }
                for (int i = 0; i < lcalDatas.size(); i++) {
                    if (lcalDatas.get(i).isCheck()) {
                        for (VolcanicSamplePointDbEntity geologicalSvyPlanningLineDbEntity : volcanicSamplePointDbEntities) {
                            if (lcalDatas.get(i).get_id() == geologicalSvyPlanningLineDbEntity.get_id()) {
                                geologicalSvyPlanningLineDbEntity.setProjectId(projectId);
                                geologicalSvyPlanningLineDbEntity.setTaskId(taskId);
                                BaseApplication.getInstance().getDaoSession().insertOrReplace(geologicalSvyPlanningLineDbEntity);
                            }
                        }
                    }
                }
                break;
            default:
                List<VolcanicSvyPointDbEntity> volcanicSvyPointDbEntities
                        = BaseApplication.getInstance().getDaoSession().loadAll(VolcanicSvyPointDbEntity.class);
                if (volcanicSvyPointDbEntities.size() == 0) {
                    return;
                }
                for (int i = 0; i < lcalDatas.size(); i++) {
                    if (lcalDatas.get(i).isCheck()) {
                        for (VolcanicSvyPointDbEntity geologicalSvyPlanningLineDbEntity : volcanicSvyPointDbEntities) {
                            if (lcalDatas.get(i).get_id() == geologicalSvyPlanningLineDbEntity.get_id()) {
                                geologicalSvyPlanningLineDbEntity.setProjectId(projectId);
                                geologicalSvyPlanningLineDbEntity.setTaskId(taskId);
                                BaseApplication.getInstance().getDaoSession().insertOrReplace(geologicalSvyPlanningLineDbEntity);
                            }
                        }
                    }
                }
                break;
        }
    }

    public void getLocalData() {
        switch (selectTableId) {
            case "1":
                lcalDatas.clear();
                List<GeologicalSvyPlanningLineDbEntity> students = BaseApplication.getInstance().getDaoSession().loadAll(GeologicalSvyPlanningLineDbEntity.class);
                refreshLayout1.finishRefresh();
                if (students.size() == 0) {
                    localAdapter.notifyDataSetChanged();
                    return;
                }
                for (int i = 0; i < students.size(); i++) {
                    if (TextUtils.isEmpty(students.get(i).getProjectId()) && TextUtils.isEmpty(students.get(i).getTaskId())) {
                        LocalBean localBean = new LocalBean();
                        localBean.setTitle(students.get(i).getId());
                        localBean.set_id(students.get(i).get_id());
                        lcalDatas.add(localBean);
                    }
                }
                localAdapter.notifyDataSetChanged();
                break;
            case "2":
                lcalDatas.clear();
                List<GeologicalSvyPlanningPtDbEntity> geologicalSvyPlanningPtDbEntities = BaseApplication.getInstance().getDaoSession().loadAll(GeologicalSvyPlanningPtDbEntity.class);
                refreshLayout1.finishRefresh();
                if (geologicalSvyPlanningPtDbEntities.size() == 0) {
                    localAdapter.notifyDataSetChanged();
                    return;
                }
                for (int i = 0; i < geologicalSvyPlanningPtDbEntities.size(); i++) {
                    if (TextUtils.isEmpty(geologicalSvyPlanningPtDbEntities.get(i).getProjectId()) && TextUtils.isEmpty(geologicalSvyPlanningPtDbEntities.get(i).getTaskId())) {
                        LocalBean localBean = new LocalBean();
                        localBean.setTitle(geologicalSvyPlanningPtDbEntities.get(i).getId());
                        localBean.set_id(geologicalSvyPlanningPtDbEntities.get(i).get_id());
                        lcalDatas.add(localBean);
                    }
                }
                localAdapter.notifyDataSetChanged();
                break;
            case "3":
                lcalDatas.clear();
                List<FaultSvyPointDbEntity> faultSvyPointDbEntities = BaseApplication.getInstance().getDaoSession().loadAll(FaultSvyPointDbEntity.class);
                refreshLayout1.finishRefresh();
                if (faultSvyPointDbEntities.size() == 0) {
                    localAdapter.notifyDataSetChanged();
                    return;
                }
                for (int i = 0; i < faultSvyPointDbEntities.size(); i++) {
                    if (TextUtils.isEmpty(faultSvyPointDbEntities.get(i).getProjectId()) && TextUtils.isEmpty(faultSvyPointDbEntities.get(i).getTaskId())) {
                        LocalBean localBean = new LocalBean();
                        localBean.setTitle(faultSvyPointDbEntities.get(i).getId());
                        localBean.set_id(faultSvyPointDbEntities.get(i).get_id());
                        lcalDatas.add(localBean);
                    }
                }
                localAdapter.notifyDataSetChanged();
                break;
            case "4":
                lcalDatas.clear();
                List<GeoGeomorphySvyPointDbEntity> geoGeomorphySvyPointDbEntities
                        = BaseApplication.getInstance().getDaoSession().loadAll(GeoGeomorphySvyPointDbEntity.class);
                refreshLayout1.finishRefresh();
                if (geoGeomorphySvyPointDbEntities.size() == 0) {
                    localAdapter.notifyDataSetChanged();
                    return;
                }
                for (int i = 0; i < geoGeomorphySvyPointDbEntities.size(); i++) {
                    if (TextUtils.isEmpty(geoGeomorphySvyPointDbEntities.get(i).getProjectId()) && TextUtils.isEmpty(geoGeomorphySvyPointDbEntities.get(i).getTaskId())) {
                        LocalBean localBean = new LocalBean();
                        localBean.setTitle(geoGeomorphySvyPointDbEntities.get(i).getId());
                        localBean.set_id(geoGeomorphySvyPointDbEntities.get(i).get_id());
                        lcalDatas.add(localBean);
                    }
                }
                localAdapter.notifyDataSetChanged();
                break;
            case "5":
                lcalDatas.clear();
                List<GeologicalSvyLineDbEntitiy> geologicalSvyLineDbEntitiys
                        = BaseApplication.getInstance().getDaoSession().loadAll(GeologicalSvyLineDbEntitiy.class);
                refreshLayout1.finishRefresh();
                if (geologicalSvyLineDbEntitiys.size() == 0) {
                    localAdapter.notifyDataSetChanged();
                    return;
                }
                for (int i = 0; i < geologicalSvyLineDbEntitiys.size(); i++) {
                    if (TextUtils.isEmpty(geologicalSvyLineDbEntitiys.get(i).getProjectId()) && TextUtils.isEmpty(geologicalSvyLineDbEntitiys.get(i).getTaskId())) {
                        LocalBean localBean = new LocalBean();
                        localBean.setTitle(geologicalSvyLineDbEntitiys.get(i).getId());
                        localBean.set_id(geologicalSvyLineDbEntitiys.get(i).get_id());
                        lcalDatas.add(localBean);
                    }
                }
                localAdapter.notifyDataSetChanged();
                break;
            case "6":
                lcalDatas.clear();
                List<GeologicalSvyPointDbEntity> geologicalSvyPointDbEntities
                        = BaseApplication.getInstance().getDaoSession().loadAll(GeologicalSvyPointDbEntity.class);
                refreshLayout1.finishRefresh();
                if (geologicalSvyPointDbEntities.size() == 0) {
                    localAdapter.notifyDataSetChanged();
                    return;
                }
                for (int i = 0; i < geologicalSvyPointDbEntities.size(); i++) {
                    if (TextUtils.isEmpty(geologicalSvyPointDbEntities.get(i).getProjectId()) && TextUtils.isEmpty(geologicalSvyPointDbEntities.get(i).getTaskId())) {
                        LocalBean localBean = new LocalBean();
                        localBean.setTitle(geologicalSvyPointDbEntities.get(i).getId());
                        localBean.set_id(geologicalSvyPointDbEntities.get(i).get_id());
                        lcalDatas.add(localBean);
                    }
                }
                localAdapter.notifyDataSetChanged();
                break;
            case "7":
                lcalDatas.clear();
                List<StratigraphySvyPointDbEntity> stratigraphySvyPointDbEntities
                        = BaseApplication.getInstance().getDaoSession().loadAll(StratigraphySvyPointDbEntity.class);
                refreshLayout1.finishRefresh();
                if (stratigraphySvyPointDbEntities.size() == 0) {
                    localAdapter.notifyDataSetChanged();
                    return;
                }
                for (int i = 0; i < stratigraphySvyPointDbEntities.size(); i++) {
                    if (TextUtils.isEmpty(stratigraphySvyPointDbEntities.get(i).getProjectId()) && TextUtils.isEmpty(stratigraphySvyPointDbEntities.get(i).getTaskId())) {
                        LocalBean localBean = new LocalBean();
                        localBean.setTitle(stratigraphySvyPointDbEntities.get(i).getId());
                        localBean.set_id(stratigraphySvyPointDbEntities.get(i).get_id());
                        lcalDatas.add(localBean);
                    }
                }
                localAdapter.notifyDataSetChanged();
                break;
            case "8":
                lcalDatas.clear();
                List<TanCaodianDbEntity> tanCaodianDbEntities
                        = BaseApplication.getInstance().getDaoSession().loadAll(TanCaodianDbEntity.class);
                refreshLayout1.finishRefresh();
                if (tanCaodianDbEntities.size() == 0) {
                    localAdapter.notifyDataSetChanged();
                    return;
                }
                for (int i = 0; i < tanCaodianDbEntities.size(); i++) {
                    if (TextUtils.isEmpty(tanCaodianDbEntities.get(i).getProjectId()) && TextUtils.isEmpty(tanCaodianDbEntities.get(i).getTaskId())) {
                        LocalBean localBean = new LocalBean();
                        localBean.setTitle(tanCaodianDbEntities.get(i).getId());
                        localBean.set_id(tanCaodianDbEntities.get(i).get_id());
                        lcalDatas.add(localBean);
                    }
                }
                localAdapter.notifyDataSetChanged();
                break;
            case "9":
                lcalDatas.clear();
                List<GeomorphySvyLineDbEntity> geomorphySvyLineDbEntities
                        = BaseApplication.getInstance().getDaoSession().loadAll(GeomorphySvyLineDbEntity.class);
                refreshLayout1.finishRefresh();
                if (geomorphySvyLineDbEntities.size() == 0) {
                    localAdapter.notifyDataSetChanged();
                    return;
                }
                for (int i = 0; i < geomorphySvyLineDbEntities.size(); i++) {
                    if (TextUtils.isEmpty(geomorphySvyLineDbEntities.get(i).getProjectId()) && TextUtils.isEmpty(geomorphySvyLineDbEntities.get(i).getTaskId())) {
                        LocalBean localBean = new LocalBean();
                        localBean.setTitle(geomorphySvyLineDbEntities.get(i).getId());
                        localBean.set_id(geomorphySvyLineDbEntities.get(i).get_id());
                        lcalDatas.add(localBean);
                    }
                }
                localAdapter.notifyDataSetChanged();
                break;
            case "10":
                lcalDatas.clear();
                List<GeomorphySvyPointDbEntity> geomorphySvyPointDbEntities
                        = BaseApplication.getInstance().getDaoSession().loadAll(GeomorphySvyPointDbEntity.class);
                refreshLayout1.finishRefresh();
                if (geomorphySvyPointDbEntities.size() == 0) {
                    localAdapter.notifyDataSetChanged();
                    return;
                }
                for (int i = 0; i < geomorphySvyPointDbEntities.size(); i++) {
                    if (TextUtils.isEmpty(geomorphySvyPointDbEntities.get(i).getProjectId()) && TextUtils.isEmpty(geomorphySvyPointDbEntities.get(i).getTaskId())) {
                        LocalBean localBean = new LocalBean();
                        localBean.setTitle(geomorphySvyPointDbEntities.get(i).getId());
                        localBean.set_id(geomorphySvyPointDbEntities.get(i).get_id());
                        lcalDatas.add(localBean);
                    }
                }
                localAdapter.notifyDataSetChanged();
                break;
            case "11":
                lcalDatas.clear();
                List<GeomorphySvyRegionDbEntity> geomorphySvyRegionDbEntities
                        = BaseApplication.getInstance().getDaoSession().loadAll(GeomorphySvyRegionDbEntity.class);
                refreshLayout1.finishRefresh();
                if (geomorphySvyRegionDbEntities.size() == 0) {
                    localAdapter.notifyDataSetChanged();
                    return;
                }
                for (int i = 0; i < geomorphySvyRegionDbEntities.size(); i++) {
                    if (TextUtils.isEmpty(geomorphySvyRegionDbEntities.get(i).getProjectId()) && TextUtils.isEmpty(geomorphySvyRegionDbEntities.get(i).getTaskId())) {
                        LocalBean localBean = new LocalBean();
                        localBean.setTitle(geomorphySvyRegionDbEntities.get(i).getId());
                        localBean.set_id(geomorphySvyRegionDbEntities.get(i).get_id());
                        lcalDatas.add(localBean);
                    }
                }
                localAdapter.notifyDataSetChanged();
                break;
            case "12":
                lcalDatas.clear();
                List<GeomorphySvyReProfDbEntity> geomorphySvyReProfDbEntities
                        = BaseApplication.getInstance().getDaoSession().loadAll(GeomorphySvyReProfDbEntity.class);
                refreshLayout1.finishRefresh();
                if (geomorphySvyReProfDbEntities.size() == 0) {
                    localAdapter.notifyDataSetChanged();
                    return;
                }
                for (int i = 0; i < geomorphySvyReProfDbEntities.size(); i++) {
                    if (TextUtils.isEmpty(geomorphySvyReProfDbEntities.get(i).getProjectId()) && TextUtils.isEmpty(geomorphySvyReProfDbEntities.get(i).getTaskId())) {
                        LocalBean localBean = new LocalBean();
                        localBean.setTitle(geomorphySvyReProfDbEntities.get(i).getId());
                        localBean.set_id(geomorphySvyReProfDbEntities.get(i).get_id());
                        lcalDatas.add(localBean);
                    }
                }
                localAdapter.notifyDataSetChanged();
                break;
            case "13":
                lcalDatas.clear();
                List<GeomorphySvySamplePointDbEntity> geomorphySvySamplePointDbEntities
                        = BaseApplication.getInstance().getDaoSession().loadAll(GeomorphySvySamplePointDbEntity.class);
                refreshLayout1.finishRefresh();
                if (geomorphySvySamplePointDbEntities.size() == 0) {
                    localAdapter.notifyDataSetChanged();
                    return;
                }
                for (int i = 0; i < geomorphySvySamplePointDbEntities.size(); i++) {
                    if (TextUtils.isEmpty(geomorphySvySamplePointDbEntities.get(i).getProjectId()) && TextUtils.isEmpty(geomorphySvySamplePointDbEntities.get(i).getTaskId())) {
                        LocalBean localBean = new LocalBean();
                        localBean.setTitle(geomorphySvySamplePointDbEntities.get(i).getId());
                        localBean.set_id(geomorphySvySamplePointDbEntities.get(i).get_id());
                        lcalDatas.add(localBean);
                    }
                }
                localAdapter.notifyDataSetChanged();
                break;
            case "14":
                lcalDatas.clear();
                List<GeomorStationDbEntity> geomorStationDbEntities
                        = BaseApplication.getInstance().getDaoSession().loadAll(GeomorStationDbEntity.class);
                refreshLayout1.finishRefresh();
                if (geomorStationDbEntities.size() == 0) {
                    localAdapter.notifyDataSetChanged();
                    return;
                }
                for (int i = 0; i < geomorStationDbEntities.size(); i++) {
                    if (TextUtils.isEmpty(geomorStationDbEntities.get(i).getProjectId()) && TextUtils.isEmpty(geomorStationDbEntities.get(i).getTaskId())) {
                        LocalBean localBean = new LocalBean();
                        localBean.setTitle(geomorStationDbEntities.get(i).getId());
                        localBean.set_id(geomorStationDbEntities.get(i).get_id());
                        lcalDatas.add(localBean);
                    }
                }
                localAdapter.notifyDataSetChanged();
                break;
            case "15":
                lcalDatas.clear();
                List<DrillHoleDbEntity> drillHoleDbEntities
                        = BaseApplication.getInstance().getDaoSession().loadAll(DrillHoleDbEntity.class);
                refreshLayout1.finishRefresh();
                if (drillHoleDbEntities.size() == 0) {
                    localAdapter.notifyDataSetChanged();
                    return;
                }
                for (int i = 0; i < drillHoleDbEntities.size(); i++) {
                    if (TextUtils.isEmpty(drillHoleDbEntities.get(i).getProjectId()) && TextUtils.isEmpty(drillHoleDbEntities.get(i).getTaskId())) {
                        LocalBean localBean = new LocalBean();
                        localBean.setTitle(drillHoleDbEntities.get(i).getId());
                        localBean.set_id(drillHoleDbEntities.get(i).get_id());
                        lcalDatas.add(localBean);
                    }
                }
                localAdapter.notifyDataSetChanged();
                break;
            case "16":
                lcalDatas.clear();
                List<SamplePointDbEntity> samplePointDbEntities
                        = BaseApplication.getInstance().getDaoSession().loadAll(SamplePointDbEntity.class);
                refreshLayout1.finishRefresh();
                if (samplePointDbEntities.size() == 0) {
                    localAdapter.notifyDataSetChanged();
                    return;
                }
                for (int i = 0; i < samplePointDbEntities.size(); i++) {
                    if (TextUtils.isEmpty(samplePointDbEntities.get(i).getProjectId()) && TextUtils.isEmpty(samplePointDbEntities.get(i).getTaskId())) {
                        LocalBean localBean = new LocalBean();
                        localBean.setTitle(samplePointDbEntities.get(i).getId());
                        localBean.set_id(samplePointDbEntities.get(i).get_id());
                        lcalDatas.add(localBean);
                    }
                }
                localAdapter.notifyDataSetChanged();
                break;
            case "17":
                lcalDatas.clear();
                List<GeophySvyLineDbEntity> geophySvyLineDbEntities
                        = BaseApplication.getInstance().getDaoSession().loadAll(GeophySvyLineDbEntity.class);
                refreshLayout1.finishRefresh();
                if (geophySvyLineDbEntities.size() == 0) {
                    localAdapter.notifyDataSetChanged();
                    return;
                }
                for (int i = 0; i < geophySvyLineDbEntities.size(); i++) {
                    if (TextUtils.isEmpty(geophySvyLineDbEntities.get(i).getProjectId()) && TextUtils.isEmpty(geophySvyLineDbEntities.get(i).getTaskId())) {
                        LocalBean localBean = new LocalBean();
                        localBean.setTitle(geophySvyLineDbEntities.get(i).getId());
                        localBean.set_id(geophySvyLineDbEntities.get(i).get_id());
                        lcalDatas.add(localBean);
                    }
                }
                localAdapter.notifyDataSetChanged();
                break;
            case "18":
                lcalDatas.clear();
                List<GeophySvyPointDbEntity> geophySvyPointDbEntities
                        = BaseApplication.getInstance().getDaoSession().loadAll(GeophySvyPointDbEntity.class);
                refreshLayout1.finishRefresh();
                if (geophySvyPointDbEntities.size() == 0) {
                    localAdapter.notifyDataSetChanged();
                    return;
                }
                for (int i = 0; i < geophySvyPointDbEntities.size(); i++) {
                    if (TextUtils.isEmpty(geophySvyPointDbEntities.get(i).getProjectId()) && TextUtils.isEmpty(geophySvyPointDbEntities.get(i).getTaskId())) {
                        LocalBean localBean = new LocalBean();
                        localBean.setTitle(geophySvyPointDbEntities.get(i).getId());
                        localBean.set_id(geophySvyPointDbEntities.get(i).get_id());
                        lcalDatas.add(localBean);
                    }
                }
                localAdapter.notifyDataSetChanged();
                break;
            case "19":
                lcalDatas.clear();
                List<GeochemicalSvyLineDbEntity> geochemicalSvyLineDbEntities
                        = BaseApplication.getInstance().getDaoSession().loadAll(GeochemicalSvyLineDbEntity.class);
                refreshLayout1.finishRefresh();
                if (geochemicalSvyLineDbEntities.size() == 0) {
                    localAdapter.notifyDataSetChanged();
                    return;
                }
                for (int i = 0; i < geochemicalSvyLineDbEntities.size(); i++) {
                    if (TextUtils.isEmpty(geochemicalSvyLineDbEntities.get(i).getProjectId()) && TextUtils.isEmpty(geochemicalSvyLineDbEntities.get(i).getTaskId())) {
                        LocalBean localBean = new LocalBean();
                        localBean.setTitle(geochemicalSvyLineDbEntities.get(i).getId());
                        localBean.set_id(geochemicalSvyLineDbEntities.get(i).get_id());
                        lcalDatas.add(localBean);
                    }
                }
                localAdapter.notifyDataSetChanged();
                break;
            case "20":
                lcalDatas.clear();
                List<GeochemicalSvyPointDbEntity> geochemicalSvyPointDbEntities
                        = BaseApplication.getInstance().getDaoSession().loadAll(GeochemicalSvyPointDbEntity.class);
                refreshLayout1.finishRefresh();
                if (geochemicalSvyPointDbEntities.size() == 0) {
                    localAdapter.notifyDataSetChanged();
                    return;
                }
                for (int i = 0; i < geochemicalSvyPointDbEntities.size(); i++) {
                    if (TextUtils.isEmpty(geochemicalSvyPointDbEntities.get(i).getProjectId()) && TextUtils.isEmpty(geochemicalSvyPointDbEntities.get(i).getTaskId())) {
                        LocalBean localBean = new LocalBean();
                        localBean.setTitle(geochemicalSvyPointDbEntities.get(i).getId());
                        localBean.set_id(geochemicalSvyPointDbEntities.get(i).get_id());
                        lcalDatas.add(localBean);
                    }
                }
                localAdapter.notifyDataSetChanged();
                break;
            case "21":
                lcalDatas.clear();
                List<CreaterDbEntity> createrDbEntities
                        = BaseApplication.getInstance().getDaoSession().loadAll(CreaterDbEntity.class);
                refreshLayout1.finishRefresh();
                if (createrDbEntities.size() == 0) {
                    localAdapter.notifyDataSetChanged();
                    return;
                }
                for (int i = 0; i < createrDbEntities.size(); i++) {
                    if (TextUtils.isEmpty(createrDbEntities.get(i).getProjectId()) && TextUtils.isEmpty(createrDbEntities.get(i).getTaskId())) {
                        LocalBean localBean = new LocalBean();
                        localBean.setTitle(createrDbEntities.get(i).getId());
                        localBean.set_id(createrDbEntities.get(i).get_id());
                        lcalDatas.add(localBean);
                    }
                }
                localAdapter.notifyDataSetChanged();
                break;
            case "22":
                lcalDatas.clear();
                List<LavaDbEntity> lavaDbEntities
                        = BaseApplication.getInstance().getDaoSession().loadAll(LavaDbEntity.class);
                refreshLayout1.finishRefresh();
                if (lavaDbEntities.size() == 0) {
                    localAdapter.notifyDataSetChanged();
                    return;
                }
                for (int i = 0; i < lavaDbEntities.size(); i++) {
                    if (TextUtils.isEmpty(lavaDbEntities.get(i).getProjectId()) && TextUtils.isEmpty(lavaDbEntities.get(i).getTaskId())) {
                        LocalBean localBean = new LocalBean();
                        localBean.setTitle(lavaDbEntities.get(i).getId());
                        localBean.set_id(lavaDbEntities.get(i).get_id());
                        lcalDatas.add(localBean);
                    }
                }
                localAdapter.notifyDataSetChanged();
                break;
            case "23":
                lcalDatas.clear();
                List<VolcanicSamplePointDbEntity> volcanicSamplePointDbEntities
                        = BaseApplication.getInstance().getDaoSession().loadAll(VolcanicSamplePointDbEntity.class);
                refreshLayout1.finishRefresh();
                if (volcanicSamplePointDbEntities.size() == 0) {
                    localAdapter.notifyDataSetChanged();
                    return;
                }
                for (int i = 0; i < volcanicSamplePointDbEntities.size(); i++) {
                    if (TextUtils.isEmpty(volcanicSamplePointDbEntities.get(i).getProjectId()) && TextUtils.isEmpty(volcanicSamplePointDbEntities.get(i).getTaskId())) {
                        LocalBean localBean = new LocalBean();
                        localBean.setTitle(volcanicSamplePointDbEntities.get(i).getId());
                        localBean.set_id(volcanicSamplePointDbEntities.get(i).get_id());
                        lcalDatas.add(localBean);
                    }
                }
                localAdapter.notifyDataSetChanged();
                break;
            case "24":
                lcalDatas.clear();
                List<VolcanicSvyPointDbEntity> volcanicSvyPointDbEntities
                        = BaseApplication.getInstance().getDaoSession().loadAll(VolcanicSvyPointDbEntity.class);
                refreshLayout1.finishRefresh();
                if (volcanicSvyPointDbEntities.size() == 0) {
                    localAdapter.notifyDataSetChanged();
                    return;
                }
                for (int i = 0; i < volcanicSvyPointDbEntities.size(); i++) {
                    if (TextUtils.isEmpty(volcanicSvyPointDbEntities.get(i).getProjectId()) && TextUtils.isEmpty(volcanicSvyPointDbEntities.get(i).getTaskId())) {
                        LocalBean localBean = new LocalBean();
                        localBean.setTitle(volcanicSvyPointDbEntities.get(i).getId());
                        localBean.set_id(volcanicSvyPointDbEntities.get(i).get_id());
                        lcalDatas.add(localBean);
                    }
                }
                localAdapter.notifyDataSetChanged();
                break;
            default:
                lcalDatas.clear();
                List<LocationEntity> locationEntities
                        = BaseApplication.getInstance().getDaoSession().loadAll(LocationEntity.class);
                refreshLayout1.finishRefresh();
                if (locationEntities.size() == 0) {
                    localAdapter.notifyDataSetChanged();
                    return;
                }
                for (int i = 0; i < locationEntities.size(); i++) {
                    if (TextUtils.isEmpty(locationEntities.get(i).getProjectId()) && TextUtils.isEmpty(locationEntities.get(i).getTaskId())) {
                        LocalBean localBean = new LocalBean();
                        localBean.setTitle(locationEntities.get(i).getStartTime());
                        localBean.set_id(locationEntities.get(i).get_id());
                        lcalDatas.add(localBean);
                    }
                }
                localAdapter.notifyDataSetChanged();
                break;
        }
    }


    private void deletePosition(long id) {
        //long id = lcalDatas.get(position).get_id();
        switch (selectTableId) {
            case "1":
                List<GeologicalSvyPlanningLineDbEntity> students =
                        BaseApplication.getInstance().getDaoSession().loadAll(GeologicalSvyPlanningLineDbEntity.class);
                for (GeologicalSvyPlanningLineDbEntity geologicalSvyPlanningLineDbEntity : students) {
                    if (id == geologicalSvyPlanningLineDbEntity.get_id()) {
                        BaseApplication.getInstance().getDaoSession().delete(geologicalSvyPlanningLineDbEntity);
                    }
                }
                break;
            case "2":
                List<GeologicalSvyPlanningPtDbEntity> geologicalSvyPlanningPtDbEntities =
                        BaseApplication.getInstance().getDaoSession().loadAll(GeologicalSvyPlanningPtDbEntity.class);
                for (GeologicalSvyPlanningPtDbEntity geologicalSvyPlanningPtDbEntity : geologicalSvyPlanningPtDbEntities) {
                    if (id == geologicalSvyPlanningPtDbEntity.get_id()) {
                        BaseApplication.getInstance().getDaoSession().delete(geologicalSvyPlanningPtDbEntity);
                    }
                }
                break;
            case "3":
                List<FaultSvyPointDbEntity> faultSvyPointDbEntities =
                        BaseApplication.getInstance().getDaoSession().loadAll(FaultSvyPointDbEntity.class);
                for (FaultSvyPointDbEntity faultSvyPointDbEntity : faultSvyPointDbEntities) {
                    if (id == faultSvyPointDbEntity.get_id()) {
                        BaseApplication.getInstance().getDaoSession().delete(faultSvyPointDbEntity);
                    }
                }
                break;
            case "4":
                List<GeoGeomorphySvyPointDbEntity> geoGeomorphySvyPointDbEntities =
                        BaseApplication.getInstance().getDaoSession().loadAll(GeoGeomorphySvyPointDbEntity.class);
                for (GeoGeomorphySvyPointDbEntity geoGeomorphySvyPointDbEntity : geoGeomorphySvyPointDbEntities) {
                    if (id == geoGeomorphySvyPointDbEntity.get_id()) {
                        BaseApplication.getInstance().getDaoSession().delete(geoGeomorphySvyPointDbEntity);
                    }
                }
                break;
            case "5":
                List<GeologicalSvyLineDbEntitiy> geologicalSvyLineDbEntitiys =
                        BaseApplication.getInstance().getDaoSession().loadAll(GeologicalSvyLineDbEntitiy.class);
                for (GeologicalSvyLineDbEntitiy geologicalSvyLineDbEntitiy : geologicalSvyLineDbEntitiys) {
                    if (id == geologicalSvyLineDbEntitiy.get_id()) {
                        BaseApplication.getInstance().getDaoSession().delete(geologicalSvyLineDbEntitiy);
                    }
                }
                break;
            case "6":
                List<GeologicalSvyPointDbEntity> geologicalSvyPointDbEntities =
                        BaseApplication.getInstance().getDaoSession().loadAll(GeologicalSvyPointDbEntity.class);
                for (GeologicalSvyPointDbEntity geologicalSvyLineDbEntitiy : geologicalSvyPointDbEntities) {
                    if (id == geologicalSvyLineDbEntitiy.get_id()) {
                        BaseApplication.getInstance().getDaoSession().delete(geologicalSvyLineDbEntitiy);
                    }
                }
                break;
            case "7":
                List<StratigraphySvyPointDbEntity> stratigraphySvyPointDbEntities =
                        BaseApplication.getInstance().getDaoSession().loadAll(StratigraphySvyPointDbEntity.class);
                for (StratigraphySvyPointDbEntity stratigraphySvyPointDbEntity : stratigraphySvyPointDbEntities) {
                    if (id == stratigraphySvyPointDbEntity.get_id()) {
                        BaseApplication.getInstance().getDaoSession().delete(stratigraphySvyPointDbEntity);
                    }
                }
                break;
            case "8":
                List<TanCaodianDbEntity> tanCaodianDbEntities =
                        BaseApplication.getInstance().getDaoSession().loadAll(TanCaodianDbEntity.class);
                for (TanCaodianDbEntity tanCaodianDbEntity : tanCaodianDbEntities) {
                    if (id == tanCaodianDbEntity.get_id()) {
                        BaseApplication.getInstance().getDaoSession().delete(tanCaodianDbEntity);
                    }
                }
                break;
            case "9":
                List<GeomorphySvyLineDbEntity> geomorphySvyLineDbEntities =
                        BaseApplication.getInstance().getDaoSession().loadAll(GeomorphySvyLineDbEntity.class);
                for (GeomorphySvyLineDbEntity geomorphySvyLineDbEntity : geomorphySvyLineDbEntities) {
                    if (id == geomorphySvyLineDbEntity.get_id()) {
                        BaseApplication.getInstance().getDaoSession().delete(geomorphySvyLineDbEntity);
                    }
                }
                break;
            case "10":
                List<GeomorphySvyPointDbEntity> geomorphySvyPointDbEntities =
                        BaseApplication.getInstance().getDaoSession().loadAll(GeomorphySvyPointDbEntity.class);
                for (GeomorphySvyPointDbEntity geomorphySvyPointDbEntity : geomorphySvyPointDbEntities) {
                    if (id == geomorphySvyPointDbEntity.get_id()) {
                        BaseApplication.getInstance().getDaoSession().delete(geomorphySvyPointDbEntity);
                    }
                }
                break;
            case "11":
                List<GeomorphySvyRegionDbEntity> geomorphySvyRegionDbEntities =
                        BaseApplication.getInstance().getDaoSession().loadAll(GeomorphySvyRegionDbEntity.class);
                for (GeomorphySvyRegionDbEntity geomorphySvyRegionDbEntity : geomorphySvyRegionDbEntities) {
                    if (id == geomorphySvyRegionDbEntity.get_id()) {
                        BaseApplication.getInstance().getDaoSession().delete(geomorphySvyRegionDbEntity);
                    }
                }
                break;
            case "12":
                List<GeomorphySvyReProfDbEntity> geomorphySvyReProfDbEntities =
                        BaseApplication.getInstance().getDaoSession().loadAll(GeomorphySvyReProfDbEntity.class);
                for (GeomorphySvyReProfDbEntity geomorphySvyReProfDbEntity : geomorphySvyReProfDbEntities) {
                    if (id == geomorphySvyReProfDbEntity.get_id()) {
                        BaseApplication.getInstance().getDaoSession().delete(geomorphySvyReProfDbEntity);
                    }
                }
                break;
            case "13":
                List<GeomorphySvySamplePointDbEntity> geomorphySvySamplePointDbEntities =
                        BaseApplication.getInstance().getDaoSession().loadAll(GeomorphySvySamplePointDbEntity.class);
                for (GeomorphySvySamplePointDbEntity geomorphySvySamplePointDbEntity : geomorphySvySamplePointDbEntities) {
                    if (id == geomorphySvySamplePointDbEntity.get_id()) {
                        BaseApplication.getInstance().getDaoSession().delete(geomorphySvySamplePointDbEntity);
                    }
                }
                break;
            case "14":
                List<GeomorStationDbEntity> geomorStationDbEntities =
                        BaseApplication.getInstance().getDaoSession().loadAll(GeomorStationDbEntity.class);
                for (GeomorStationDbEntity geomorStationDbEntity : geomorStationDbEntities) {
                    if (id == geomorStationDbEntity.get_id()) {
                        BaseApplication.getInstance().getDaoSession().delete(geomorStationDbEntity);
                    }
                }
                break;
            case "15":
                List<DrillHoleDbEntity> drillHoleDbEntities =
                        BaseApplication.getInstance().getDaoSession().loadAll(DrillHoleDbEntity.class);
                for (DrillHoleDbEntity geomorStationDbEntity : drillHoleDbEntities) {
                    if (id == geomorStationDbEntity.get_id()) {
                        BaseApplication.getInstance().getDaoSession().delete(geomorStationDbEntity);
                    }
                }
                break;
            case "16":
                List<SamplePointDbEntity> samplePointDbEntities =
                        BaseApplication.getInstance().getDaoSession().loadAll(SamplePointDbEntity.class);
                for (SamplePointDbEntity samplePointDbEntity : samplePointDbEntities) {
                    if (id == samplePointDbEntity.get_id()) {
                        BaseApplication.getInstance().getDaoSession().delete(samplePointDbEntity);
                    }
                }
                break;
            case "17":
                List<GeophySvyLineDbEntity> geophySvyLineDbEntities =
                        BaseApplication.getInstance().getDaoSession().loadAll(GeophySvyLineDbEntity.class);
                for (GeophySvyLineDbEntity geophySvyLineDbEntity : geophySvyLineDbEntities) {
                    if (id == geophySvyLineDbEntity.get_id()) {
                        BaseApplication.getInstance().getDaoSession().delete(geophySvyLineDbEntity);
                    }
                }
                break;
            case "18":
                List<GeophySvyPointDbEntity> geophySvyPointDbEntities =
                        BaseApplication.getInstance().getDaoSession().loadAll(GeophySvyPointDbEntity.class);
                for (GeophySvyPointDbEntity geophySvyPointDbEntity : geophySvyPointDbEntities) {
                    if (id == geophySvyPointDbEntity.get_id()) {
                        BaseApplication.getInstance().getDaoSession().delete(geophySvyPointDbEntity);
                    }
                }
                break;
            case "19":
                List<GeochemicalSvyLineDbEntity> geochemicalSvyLineDbEntities =
                        BaseApplication.getInstance().getDaoSession().loadAll(GeochemicalSvyLineDbEntity.class);
                for (GeochemicalSvyLineDbEntity geochemicalSvyLineDbEntity : geochemicalSvyLineDbEntities) {
                    if (id == geochemicalSvyLineDbEntity.get_id()) {
                        BaseApplication.getInstance().getDaoSession().delete(geochemicalSvyLineDbEntity);
                    }
                }
                break;
            case "20":
                List<GeochemicalSvyPointDbEntity> geochemicalSvyPointDbEntities =
                        BaseApplication.getInstance().getDaoSession().loadAll(GeochemicalSvyPointDbEntity.class);
                for (GeochemicalSvyPointDbEntity geochemicalSvyPointDbEntity : geochemicalSvyPointDbEntities) {
                    if (id == geochemicalSvyPointDbEntity.get_id()) {
                        BaseApplication.getInstance().getDaoSession().delete(geochemicalSvyPointDbEntity);
                    }
                }
                break;
            case "21":
                List<CreaterDbEntity> createrDbEntities =
                        BaseApplication.getInstance().getDaoSession().loadAll(CreaterDbEntity.class);
                for (CreaterDbEntity createrDbEntity : createrDbEntities) {
                    if (id == createrDbEntity.get_id()) {
                        BaseApplication.getInstance().getDaoSession().delete(createrDbEntity);
                    }
                }
                break;
            case "22":
                List<LavaDbEntity> lavaDbEntities =
                        BaseApplication.getInstance().getDaoSession().loadAll(LavaDbEntity.class);
                for (LavaDbEntity lavaDbEntity : lavaDbEntities) {
                    if (id == lavaDbEntity.get_id()) {
                        BaseApplication.getInstance().getDaoSession().delete(lavaDbEntity);
                    }
                }
                break;
            case "23":
                List<VolcanicSamplePointDbEntity> volcanicSamplePointDbEntities =
                        BaseApplication.getInstance().getDaoSession().loadAll(VolcanicSamplePointDbEntity.class);
                for (VolcanicSamplePointDbEntity volcanicSamplePointDbEntity : volcanicSamplePointDbEntities) {
                    if (id == volcanicSamplePointDbEntity.get_id()) {
                        BaseApplication.getInstance().getDaoSession().delete(volcanicSamplePointDbEntity);
                    }
                }
                break;
            case "24":
                List<VolcanicSvyPointDbEntity> volcanicSvyPointDbEntities =
                        BaseApplication.getInstance().getDaoSession().loadAll(VolcanicSvyPointDbEntity.class);
                for (VolcanicSvyPointDbEntity volcanicSvyPointDbEntity : volcanicSvyPointDbEntities) {
                    if (id == volcanicSvyPointDbEntity.get_id()) {
                        BaseApplication.getInstance().getDaoSession().delete(volcanicSvyPointDbEntity);
                    }
                }
                break;
            default:
                List<LocationEntity> locationEntities =
                        BaseApplication.getInstance().getDaoSession().loadAll(LocationEntity.class);
                for (LocationEntity locationEntity : locationEntities) {
                    if (id == locationEntity.get_id()) {
                        BaseApplication.getInstance().getDaoSession().delete(locationEntity);
                    }
                }
                break;
        }
    }
}
